#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i = 0, no, sum = 0;
  cin >> n;
  for (int j = 0; j < n; j++) {
    cin >> no;
    sum = no * i + sum;
    i = i + 4;
  }
  cout << sum << endl;
  return 0;
}
