#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) * block) { cout << C - (B - 1) * block; } else { cout << block * A + A; } }