#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)); if( x < 0){ break; } // printf("%d %d %d %d\n", A, B, x, y); tmp = A*x+B*y; if( (ans!=0) && (ans <= tmp)){ break; } if( (ans == 0) || (T <= tmp && tmp <= ans) ){ ans = tmp; if(ans == T){ break; } } } printf("%d\n", ans); return 0; }