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