#include using namespace std; int main() { int a, b, t; cin >> a >> b >> t; int y = (t + b-1)/b*b; for (int i = 0; i <= t and t < y; i += b) { int x = i + (t-i + a-1)/a*a; if (x < y) y = x; } cout << y << endl; return 0; }