#include <cstdio>
#include <cassert>
#include <algorithm>

using namespace std;

int f( int n, int a, int b ) {
  if (n < 2) {
    return 0;
  }
  if (a < b) {
    return a + f(n / 3, a, b);
  } else {
    return b + f(n / 3, a, b);
  }
}

int main() {
  assert(freopen("apricot.in", "r", stdin));
  assert(freopen("apricot.out", "w", stdout));

  int n, a, b;
  assert(scanf("%d%d%d", &n, &a, &b));
  printf("%d\n", f(n, a, b));

  return 0;
}
