#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[105];
  cin >> n;
  int x = 1;
  for (int i = 0; i < n; i++) cin >> a[i];
  int ans = 0;
  int p;
  for (int i = 0; i < n; i++) {
    p = abs(i + 1 - x);
    p += i;
    p += abs(x - 1);
    p = p * a[i];
    ans += p;
  }
  cout << 2 * ans << endl;
}
