A题
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<string.h>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<set>
#include<vector>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
const int maxn =1e5+5;
const int maxm=10000;
const int mod =998244353;
const int INF=0x3f3f3f3f;
const double eps=1e-8;
int main()
{
int n;scanf("%d",&n);
int dis=0,sum=0;
int m=0;
int a[105];
for(int i=0;i<n;i++)
{
scanf("%d",&a[i]);
if(dis>a[i])
{
dis=a[i];
m=i;
}
}
for(int i=0;i<n;i++)
{
if(i>m)sum+=(i*4*a[i]);
else sum+=(m*4*a[i]);
}
printf("%d\n",sum);
return 0;
}