import std.experimental.all; T read(T)() { return readln.chomp.to!T; } T[] reads(T)() { return readln.split.to!(T[]); } alias readint = read!int; alias readints = reads!int; 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; } return ans; } void main() { auto abt = readints; int a = abt[0], b = abt[1], t = abt[2]; auto ans = calc(a, b, t); writeln(ans); }