#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10, mod = 1e9 + 7;
const long long inf = 1e18;
long long a[maxn];
long long dp[maxn][8];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie();
  int n;
  long long A, B, C, D;
  cin >> n >> A >> B >> C >> D;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < 8; i++) {
    dp[n][i] = inf;
  }
  for (int i = n - 1; i >= 0; i--) {
    for (int msk = 0; msk < (1 << 3); msk++) {
      dp[i][msk] = inf;
      long long x = min(1ll * min(A, C) * (a[i] + 1), B);
      long long y = 1ll * min(A, C) * a[i] + C;
      if ((((msk) >> (2)) & 1) == 0)
        dp[i][msk] = min(dp[i][msk], min(dp[i + 1][msk << 1] + y + D,
                                         dp[i + 1][(msk << 1) | 1] + x + D));
      int cnt = 32 - __builtin_clz(msk);
      cnt = max(cnt, int(1));
      long long z = min(x + min({A, B, C}), y);
      dp[i][msk] =
          min(dp[i][msk], z + min({A, B, C}) * __builtin_popcount(msk) +
                              1ll * (2 * cnt + 1) * D + dp[i + 1][0]);
      if (i == n - 1) {
        dp[i][msk] =
            min(dp[i][msk], z + min({A, B, C}) * __builtin_popcount(msk) +
                                1ll * (2 * cnt) * D);
        int cnt = 32 - __builtin_clz(msk);
        dp[i][msk] =
            min(dp[i][msk],
                y + min({A, B, C}) * __builtin_popcount(msk) + 1ll * cnt * D);
      }
    }
  }
  return cout << dp[0][0] << endl, 0;
}
