#include <bits/stdc++.h>
using namespace std;
int n;
int a[109];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int crnt = 0;
  for (int i = 1; i < n; i++) {
    crnt += i * 2 * 2 * a[i];
  }
  cout << crnt << endl;
}
