#include<bits/stdc++.h>
using namespace std;

long long a[999999],qishi[999999];

int main()
{
	long long n,m,p1,s1,s2;
	long long dragon=0,tiger=0;
	cin >> n;
	for(long long i=1;i<=n;i++)
		cin >> a[i];
	cin >> m >> p1 >> s1 >> s2;
	a[p1]+=s1;
	for(long long i=1;i<=n;i++)
		qishi[i]=a[i]*abs(i-m);
	for(long long i=1;i<m;i++)
		dragon+=qishi[i];
	for(long long i=n;i>m;i--)
		tiger+=qishi[i];
	long long c=abs(dragon-tiger),maxn=m;
	if(dragon>tiger)
	{
		for(long long i=m+1;i<=n;i++)
		{
			if(c>abs(tiger+((i-m)*s2)-dragon))
			{
				c=abs(tiger+((i-m)*s2)-dragon);
				maxn=i;
			}
		}
		cout << maxn << endl;
	}
	if(dragon<tiger)
	{
		for(long long i=1;i<m;i++)	
		{
			if(c>abs(dragon+((m-i)*s2)-tiger))
			{
				c=abs(dragon+((m-i)*s2)-tiger);
				maxn=i;
			}
		}
		cout << maxn << endl;
	}
	
	return 0;
}

3 comments

  • 1