#include "bits/stdc++.h" using namespace std; #define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i)) #define rep(i,j) FOR(i,0,j) #define each(x,y) for(auto &(x):(y)) #define mp make_pair #define all(x) (x).begin(),(x).end() #define debug(x) cout<<#x<<": "<<(x)< pii; typedef vector vi; typedef vector vll; long long gcd(long long a, long long b){ return b?gcd(b, a%b):a; } long long lcm(long long a, long long b){ return a*b/gcd(a,b); } int main(){ ll A, B, T; cin >> A >> B >> T; //ll l = lcm(A, B); //ll z = T / l * l; //T %= l; //debug(z); ll z = 0; ll ans = LLONG_MAX; for(ll y = 0; ; ++y){ ll by = B*y; ll x = max(0ll, (T - by + A - 1) / A); ll ax = A*x; smin(ans, ax + by + z); if(by >= T)break; } cout << ans << endl; }