#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[110], ans = 0;
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i) ans += 4 * i * a[i];
  cout << ans;
  return 0;
}
