import math, strutils, sequtils var a, b: int (a, b) = stdin.readline.split.map parseInt var n = stdin.readline.parseInt if n == 1: echo 0 quit 0 var ans = 1 shl 61 for i in 1..n: var root = int(ceil(pow(float(n), 1 / i))) var ok = 0 ng = i while ng - ok > 1: var mid = (ok + ng) div 2 if (root - 1) ^ mid * root ^ (i - mid) >= n: ok = mid else: ng = mid ans = min(ans, (a + b * (root - 2)) * ok + (a + b * (root - 1)) * (i - ok)) if root == 2: break echo ans