N = int(input()) C,V = list(map(int, input().split(' '))) def factorize(n): i = 2 nn = n factors = {} while i * i <= n: if nn % i == 0: nn /= i if i in factors: factors[i] = factors[i] + 1 else: factors[i] = 1 else: i = i + 1 if nn != 1: nn = int(nn) if nn in factors: factors[nn] = factors[nn] + 1 else: factors[nn] = 1 return factors def find(n): factors = factorize(n) minimum = float('inf') for factor in factors: cost = 0 rest = C + V * ((n // (factor ** factors[factor]))-1) if factor % 2 == 1: cost = C + V * (factor-1) + rest else: cost = (C + V) * factors[factor] + rest minimum = min(minimum, cost) return min(minimum, C + V * (N-1)) minimum = float('inf') minimum = min(minimum, find(N)) minimum = min(minimum, find(N+1)) minimum = min(minimum, find(N+2)) print(minimum)