import std; int calc(int a, int b, int t) { // ax + by >= t int ans = int.max; for (int y = 0; ; y++) { // b 円の切手の枚数を固定する auto t2 = t - b * y; if (t2 <= 0) { // b 円の切手だけで t 円超えた ans = min(ans, b * y); break; } auto x = (t2 + a - 1) / a; ans = min(ans, a * x + b * y); if (y == a) break; // これがないと TLE } return ans; } void main() { int a, b, t; scan(a, b, t); writeln(calc(a, b, t)); } void scan(T...)(ref T a) { string[] ss = readln.split; foreach (i, t; T) a[i] = ss[i].to!t; } T read(T)() { return readln.chomp.to!T; } T[] reads(T)() { return readln.split.to!(T[]); } alias readint = read!int; alias readints = reads!int;