#include #define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++) #define INF 1000000000LL #define fi first #define se second using namespace std; typedef long long ll; typedef pair pll; ll N, C, V; pll dp[100001]; int main(void) { cin >> N >> C >> V; REP(i, 0, N + 1) dp[i] = pll(-INF, -INF); dp[0] = pll(1, 0); ll ans; REP(i, 0, 100001) { if(dp[i].fi >= N) { ans = i; break; } ll c = i + C; ll v = i + V; if(c >= 100000) c = 100000; if(v >= 100000) v = 100000; dp[c] = max(dp[c], pll(dp[i].fi, dp[i].fi)); dp[v] = max(dp[v], pll(dp[i].fi + dp[i].se, dp[i].se)); } cout << ans << endl; }