func_code_string: #include <bits/stdc++.h>   using namespace std;   long long n, r1, r2, r3, d;   long long a[1000003];   long long dp[1000003][2];   long long f(int i, int j) {     if (i == n) return -d;     if (dp[i][j] != -1) return dp[i][j];     long long res1 = 1e18, res2 = 1e18;     if (j == 0) {       res1 = f(i + 1, 0) + a[i] * r1 + r3 + d;       res2 = f(i + 1, 1) + min(a[i] * r1 + 2 * r1, r2 + r1) + 3 * d;     }     if (j == 1) {       if (i != n - 1)         res1 = f(i + 1, 0) +                min(a[i] * r1 + r3, min(a[i] * r1 + 2 * r1, r2 + r1)) + d;       else         res1 = f(i + 1, 0) +                min(a[i] * r1 + r3, min(a[i] * r1 + 2 * r1 + d, r2 + r1 + d));     }     return dp[i][j] = min(res1, res2);   }   int main() {     cin >> n >> r1 >> r2 >> r3 >> d;     for (int i = 0; i < n; i++) {       cin >> a[i];     }     memset(dp, -1, sizeof dp);     cout << f(0, 0) << endl;   }   