" Life is not a problem to be solved but a reality to be experienced! "
© Copyright 2013 - 2025 KUDO.TIPS - All rights reserved.
//M4kP4w31
using namespace std;
int main() {
int n, k;
cin >> n >> k;
int wynik = n;
int resztki = 0;
while (n) {
resztki += n;
n = resztki / k;
resztki %= k;
wynik += n;
}
cout << wynik;
}