#include #include #include #include constexpr uint64_t inf = std::numeric_limits::max() / 2; int main() { size_t n; uint64_t k, x; std::cin >> n >> k >> x; std::array pd{ 0, inf }; for (uint64_t i = 0; i < n; ++i) { uint64_t c; std::cin >> c; std::array dp{ inf, inf }; for (bool f : { 0, 1 }) for (bool g : { 0, 1 }) { dp[g] = std::min(dp[g], pd[f] + (not g) * c + g * k + (not f and g) * x); } dp.swap(pd); } std::cout << std::min(pd[0], pd[1]) << std::endl; }