#include #include #include int main(void){ int A,B,T; int x,y; int ans = 0; scanf("%d %d %d", &A,&B, &T); for(y=0;y<=(T/B)+1;y++){ int tmp; x = ceil((1.0*T-B*y)/(1.0*A)); tmp = A*x+B*y; if( (ans == 0) || (T <= tmp && tmp <= ans) ){ ans = tmp; if(ans == T){ break; } } } printf("%d\n", ans); return 0; }