#include using namespace std; template void setmin(T & a, T const & b) { if (b < a) a = b; } const int inf = 1e9+7; int main() { int a, b, t; cin >> a >> b >> t; int ans = inf; for (int i = 0; i <= t; i += b) { setmin(ans, i + (t - i + a-1)/a*a); } cout << ans << endl; return 0; }