#include #include using namespace std; int main() { int n; cin >> n; long long k, x; cin >> k >> x; vector a(n); for (int i = 0; i < n; i++) cin >> a[i]; long long s = x, t = 0; for (int i = 0; i < n; ++i) { tie(s, t) = make_pair(min(s + k, t + k + x), min(s, t) + a[i]); } cout << min(s, t) << '\n'; }