#include using namespace std; long long exchange_requirement, empty_bottles_amount, filled_bottles_amount, ans; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin >> exchange_requirement >> filled_bottles_amount; while (true) { ans += filled_bottles_amount; empty_bottles_amount += filled_bottles_amount; filled_bottles_amount = empty_bottles_amount / exchange_requirement; empty_bottles_amount %= exchange_requirement; if (filled_bottles_amount == 0) { break; } } cout << ans << endl; return 0; }