func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1000010;   long long f[N][2];   long long a[N];   long long n, r1, r2, r3, d;   int main() {     cin >> n >> r1 >> r2 >> r3 >> d;     for (int i = 1; i <= n; i++) cin >> a[i];     memset(f, 0x3f, sizeof f);     f[1][0] = r1 * a[1] + r3;     f[1][1] = min(r1 * (a[1] + 1), r2);     for (int i = 1; i < n; i++) {       long long t0 = r1 * a[i + 1] + r3;       long long t11 = r2;       long long t12 = r1 * (a[i + 1] + 1);       f[i + 1][1] = min(f[i + 1][1], f[i][0] + d + min(t11, t12));       f[i + 1][1] = min(f[i + 1][1], f[i][1] + d + min(t11, t12) + d + r1 + d);       f[i + 1][0] = min(f[i + 1][0], f[i][0] + d + t0);       f[i + 1][0] =           min(f[i + 1][0], f[i][1] + d + min(t11, t12) + 2 * d + 2 * r1);       f[i + 1][0] = min(f[i + 1][0], f[i][1] + t0 + r1 + 3 * d);     }     cout << min(f[n][0], f[n - 1][1] + d + r1 * a[n] + r3 + d + r1) << endl;   }   