import std.stdio, std.string, std.conv, std.algorithm, std.numeric; import std.range, std.array, std.math, std.typecons, std.container, core.bitop; void main() { long a, b, c; scan(a, b, c); long btm = 0, top = 10L^^18; bool check (long k) { if (b == 1) { return k >= c; } else { return (k / a) >= (c - k + b - 2) / (b - 1); } } while (top - btm > 1) { long mid = (btm + top) / 2; if (check(mid)) { top = mid; } else { btm = mid; } } writeln(top); } void scan(T...)(ref T args) { string[] line = readln.split; foreach (ref arg; args) { arg = line.front.to!(typeof(arg)); line.popFront(); } assert(line.empty); } void fillAll(R, T)(ref R arr, T value) { static if (is(typeof(arr[] = value))) { arr[] = value; } else { foreach (ref e; arr) { fillAll(e, value); } } }