#include #include #include #include #include #include #pragma GCC optimize("O2") using ll = long long int; const int INF = (1<<30); const ll INFLL = (1ll<<60); const ll MOD = (ll)(1e9+7); #define l_ength size void mul_mod(ll& a, ll b){ a *= b; a %= MOD; } void add_mod(ll& a, ll b){ a = (a> n >> y >> x; for(i=0; i> a[i]; for(j=0; j<2; ++j){ for(k=0; k<2; ++k){ dp[i+1][k] = std::min(dp[i+1][k],dp[i][j]+a[i]*(1-k)+y*k+x*((1-j)&k)); } } } std::cout << (std::min(dp[n][0],dp[n][1])) << std::endl; return 0; }