func_code_string: #include <bits/stdc++.h>   using namespace std;   mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());   const long long INF = 1e18;   signed main() {     ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);     long long n, r1, r2, r3, d;     cin >> n >> r1 >> r2 >> r3 >> d;     vector<long long> a(n), x(n), y(n);     vector<vector<long long>> dp(n + 1, vector<long long>(2, INF));     dp[0][0] = 0;     for (long long i = 0; i < n; i++) {       cin >> a[i];     }     for (long long i = 0; i < n; i++) {       x[i] = a[i] * r1 + r3;       y[i] = min(r1 + r2, (a[i] + 2) * r1);       y[i] = min(y[i], x[i]);     }     for (long long i = 0; i < n; i++) {       dp[i + 1][0] = min(dp[i][0] + x[i], dp[i][1] + y[i] + d);       dp[i + 1][1] = dp[i][0] + y[i] + d;       if (i == n - 1) dp[i + 1][0] = min(dp[i + 1][0], dp[i][1] + x[i]);     }     long long ans = min(dp[n][0], dp[n][1] + d);     ans += d * (n - 1);     cout << ans <<   n ;   }   