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