func main() var a: int :: cui@inputInt() var b: int :: cui@inputInt() var c: int :: cui@inputInt() var ok: int :: 10 ^ 18 var ng: int :: 0 while((ok - ng).abs() > 1) var md: int :: (ok + ng) / 2 if(f(md, a, b, c)) do ok :: md else do ng :: md end if end while var ans: int :: ok do cui@print("\{ans}\n") func f(d: int, a: int, b: int, c: int): bool var sum: num@BigInt :: num@makeBigIntFromInt(0) var nb: num@BigInt :: num@makeBigIntFromInt(b) var nc: num@BigInt :: num@makeBigIntFromInt(c) do nb :: nb.mulInt(d / a) do sum :: sum.add(nb) do sum :: sum.addInt(d - d / a) ret sum >= nc end func end func