#include <bits/stdc++.h>
using namespace std;
long long dp[4009][4009];
long long mi(long long a, long long b) {
  if (a < b)
    return a;
  else
    return b;
}
int main() {
  long long n, en, ans = 0;
  cin >> n >> en;
  ans += n * en;
  vector<long long> x;
  for (int i = 0; i < n; i++) {
    long long tmp;
    cin >> tmp;
    x.push_back(tmp);
    ans += 5 * x[i];
  }
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= n; j++) {
      dp[i][j] = 114514191981089345;
    }
  }
  dp[n - 1][1] = en;
  for (int i = n - 2; i >= 0; i--) {
    for (int j = 1; j <= n - i; j++) {
      if (dp[i + 1][j] != -1) dp[i][j + 1] = dp[i + 1][j] + 2 * (j - 1) * x[i];
    }
    dp[i][1] = dp[i + 1][1] + en;
    for (int j = 2; j <= n - i; j++) {
      if (dp[i + 1][j] != -1) dp[i][1] = mi(dp[i][1], dp[i + 1][j] + en);
    }
  }
  long long res = dp[0][1];
  for (int i = 2; i <= n; i++) {
    if (dp[0][i] != -1) {
      res = mi(res, dp[0][i]);
    }
  }
  ans += res;
  cout << ans << endl;
  return 0;
}
