#include #include using namespace std; using vi=vector; struct q_t { int c, cn, n; bool operator<(const q_t&rhs) const { return c>rhs.c; } }; class que_t { priority_queue q; public: void push(int c, int cn, int n) { q.push((q_t){c, cn, n}); } bool pop(int&c, int&cn, int&n) { if(q.empty()) return false; c=q.top().c; cn=q.top().cn; n=q.top().n; q.pop(); return true; } }; int solve(int n, int c, int v) { que_t q; int rc=0, rcn=0, rn=1; q.push(rc, rcn, rn); while(q.pop(rc, rcn, rn)) { //printf("c=%d cn=%d n=%d\n", rc, rcn, rn); if(rn>=n) return rc; q.push(rc+c+v, rn, rn+rn); if(rcn>0) q.push(rc+v, rcn, rn+rcn); } return -1; } int main(void) { int n, c, v; while(scanf("%d%d%d", &n, &c, &v)==3) { printf("%d\n", solve(n, c, v)); } return 0; }