Xuanxuan and Kaikai are playing a game called "The Big Battle". The board of the game is a line segment with
barracks (labelled
from left to right). The distance between any two adjacent numbered barracks is always
cm, that is, the board is a line segment of length
cm. There are
soldiers in barracks
.
The figure below is an example of
:
Xuanxuan is on the left, representing "Dragon"; Kaikai is on the right, representing "Tiger". They used the barracks
as the dividing line. The soldiers on the left of the dividing line belong to the Dragon army, and the soldiers on the right of the line belong to the Tiger army. Soldiers in the barracks numbered
are very tangled; thus they do not belong to either side.
The strength of a barracks is defined as the number of soldiers in the barracks
the distance from the barracks to the barracks
; the total strength of an army participating in the game is defined as the sum of the strength of all barracks belonging to this army.
The figure below is an example of
,
, where red is the Dragon army and yellow is the Tiger army:
During the game, at a certain moment, a total of
soldiers suddenly appeared in the barracks
. As friends of Xuanxuan and Kaikai, you know that if there is a huge difference in total strength between the Dragon army and Tiger army, Xuanxuan and Kaikai will not be willing to continue playing. In order to continue the game, you need to choose a barracks
, and send out all
soldiers to barracks
, so that the difference in total strength between the two sides is as small as possible.
The soldiers you are sending out belong to the army in the barracks you sent them out to (if you sent them into the barracks
, they will not belong to any army).
Input Specification
The first line of the input contains a positive integer
, representing the number of barracks.
The next line contains
space-separated positive integers, and the
-th positive integer represents the initial number of soldiers
in barracks
.
The next line contains four space-separated positive integers, representing
respectively.
Output Specification
Output a single line containing a positive integer,
, representing the barracks you choose to send the soldiers to. If there are multiple optimal barracks, output the barracks with the smallest label.
Sample Input 1
Copy
6
2 3 2 3 2 3
4 6 5 2
Sample Output 1
Copy
2
Explanation for Sample 1
The two sides are divided by barracks
, and
soldiers suddenly appear in barracks
.
The total strength of Dragon army is
.
The total strength of Tiger army is
.
When you send
soldiers to the barracks
, Dragon army's total strength becomes
.
At this time, the two sides are equal in total strength.
Sample Input 2
Copy
6
1 1 1 1 1 16
5 4 1 1
Sample Output 2
Copy
1
Explanation for Sample 2
The two sides are divided by barracks
, and
soldiers suddenly appear in barracks
.
The total strength of Dragon army is
.
The total strength of Tiger army is
.
When you send
soldiers to the barracks
, Dragon army's total strength becomes
.
At this time, the difference between the two sides is minimized.
Constraints
, 
For
of the data,
,
,
,
.
There is another
of the data,
,
,
,
.
For
of the data,
,
,
.
For
of the data,
,
.
For
of the data,
,
.
Problem translated to English by Tommy_Shan.
Comments