def main(): from math import inf, floor, ceil A, B = map(int, input().split()) N = int(input()) if N == 1: print(0) exit() ans = inf for i in range(1, N + 1): a, b = floor(N ** (1 / i)), ceil(N ** (1 / i)) powa, powb = [1], [1] for j in range(i): powa.append(powa[-1] * a) powb.append(powb[-1] * b) for j in range(i + 1): if powa[j] * powb[i - j] >= N: ans = min(ans, (A + B * (a - 1)) * j + (A + B * (b - 1)) * (i - j)) if b == 2: break print(ans) if __name__ == '__main__': main()