#include using namespace std; int main(void){ long long A,B,C; cin >> A >> B >> C; long long block; block = C / (A + B - 1); if(A > C % (A + B - 1)) { cout << C - (B - 1) * block; } else { cout << (block + 1)* A; } }