While we're in the same area, we can also avoid performing std::stoi in a loop when it only needs to be performed once.