At the beginning of the school year Berland State University starts two city school programming groups, for beginners and for intermediate coders. The children were tested in order to sort them into groups. According to the results, each student got some score from 1 to m points. We know that c_1 schoolchildren got 1 point, c_2 children got 2 points, ..., c_{m} children got m points. Now you need to set the passing rate k (integer from 1 to m): all schoolchildren who got less than k points go to the beginner group and those who get at strictly least k points go to the intermediate group. We know that if the size of a group is more than y, then the university won't find a room for them. We also know that if a group has less than x schoolchildren, then it is too small and there's no point in having classes with it. So, you need to split all schoolchildren into two groups so that the size of each group was from x to y, inclusive. 

Help the university pick the passing rate in a way that meets these requirements.


-----Input-----

The first line contains integer m (2 ≤ m ≤ 100). The second line contains m integers c_1, c_2, ..., c_{m}, separated by single spaces (0 ≤ c_{i} ≤ 100). The third line contains two space-separated integers x and y (1 ≤ x ≤ y ≤ 10000). At least one c_{i} is greater than 0.


-----Output-----

If it is impossible to pick a passing rate in a way that makes the size of each resulting groups at least x and at most y, print 0. Otherwise, print an integer from 1 to m — the passing rate you'd like to suggest. If there are multiple possible answers, print any of them.


-----Examples-----
Input
5
3 4 3 2 1
6 8

Output
3

Input
5
0 3 3 4 2
3 10

Output
4

Input
2
2 5
3 6

Output
0



-----Note-----

In the first sample the beginner group has 7 students, the intermediate group has 6 of them. 

In the second sample another correct answer is 3.

Difficulty: EASY
Tags: Complete search

Implementation

Greedy algorithms
Skill types: Complete search

Greedy algorithms

Starter code:

Solutions:
def work(arr, x, y, m):
	tot = sum(arr)
	for i in range(m):
		a = sum(arr[:i])
		b = tot - a
		if a in range(x, y + 1) and b in range(x, y + 1):
			return i + 1
	return 0
m = int(input())
arr = list(map(int, input().split()))
(x, y) = list(map(int, input().split()))
print(work(arr, x, y, m))


n = int(input())
a = list(map(int, input().split()))
(x, y) = map(int, input().split())
for i in range(n):
	if x <= sum(a[:i]) <= y and x <= sum(a[i:]) <= y:
		print(i + 1)
		exit()
print(0)


n = int(input())
a = list(map(int, input().split()))
(x, y) = list(map(int, input().split()))
beginers = 0
total = sum(a)
k = 0
for i in range(len(a)):
	if beginers + a[i] <= y:
		beginers += a[i]
	if x <= beginers <= y and x <= total - beginers <= y:
		k = i + 2
		break
print(k)


m = int(input())
c = [int(x) for x in input().split()]
(x, y) = [int(x) for x in input().split()]
sum1 = 0
sum2 = 0
k = 0
for i in range(m):
	sum1 = sum(c[:i])
	sum2 = sum(c[i:])
	if x <= sum1 <= y and x <= sum2 <= y:
		k = i + 1
		break
print(k)


m = int(input())
l = [int(x) for x in input().split()]
(lo, hi) = [int(x) for x in input().split()]
num = sum(l)
cur = 0
sc = 0
done = False
for x in l:
	cur += x
	sc += 1
	if cur >= lo and cur <= hi and (num - cur >= lo) and (num - cur <= hi):
		print(str(sc + 1))
		done = True
		break
if done == False:
	print(str(0))


n = int(input().split()[0])
studentScore = input().split()
idx = 0
for i in studentScore:
	studentScore[idx] = int(i)
	idx += 1
xy = input().split()
x = int(xy[0])
y = int(xy[1])
if sum(studentScore) < 2 * x or sum(studentScore) > 2 * y:
	print(0)
else:
	countBeginner = int(0)
	index = int(0)
	while countBeginner < x:
		countBeginner += studentScore[index]
		index += 1
	index -= 1
	idxdesc = n - 1
	countIntermediate = 0
	while idxdesc != index and countIntermediate < x:
		countIntermediate += studentScore[idxdesc]
		idxdesc -= 1
	idxdesc += 1
	if countIntermediate > y or countBeginner > y:
		print(0)
	elif index + 1 == idxdesc:
		print(idxdesc + 1)
	else:
		while index + 1 < idxdesc and countBeginner + studentScore[index + 1] <= y:
			index += 1
			countBeginner += studentScore[index]
		if index + 1 != idxdesc:
			while index < idxdesc - 1:
				idxdesc -= 1
				countIntermediate += studentScore[idxdesc]
		if countIntermediate <= y:
			print(idxdesc + 1)
		else:
			print(0)


from bisect import bisect_right

def intinp():
	return list(map(int, input().split()))

def fx(B, x):
	t = bisect_right(B, x)
	if t:
		if B[t - 1] >= x:
			return t - 1
		else:
			return t
	else:
		return 0
m = int(input())
A = intinp()
(x, y) = intinp()
B = []
B.append(A[0])
for i in range(1, m):
	B.append(B[i - 1] + A[i])
i = fx(B, x)
A.append(0)
B.append(0)
if i == -1:
	print(0)
else:
	while x <= B[i] <= y and B[m - 1] - B[i] > y and (i < m):
		i += 1
	if i + 2 <= m and x <= B[i] <= y and (x <= B[m - 1] - B[i] <= y):
		print(i + 2)
	else:
		print(0)


__author__ = 'Lipen'

def actions(m, nums, x, y):
	for t in range(1, m):
		s1 = sum(nums[:t])
		s2 = sum(nums[t:])
		if s1 <= y and s2 >= x:
			if s1 >= x and s2 <= y:
				return t + 1
		else:
			return 0
	return 0

def main():
	m = int(input())
	nums = list(map(int, input().split()))
	(x, y) = list(map(int, input().split()))
	k = actions(m, nums, x, y)
	print(k)
main()


m = int(input())
c = list(map(int, input().split()))
inputting = list(map(int, input().split()))
x = inputting[0]
y = inputting[1]
array = []
for i in range(m):
	for j in range(c[i]):
		array.append(i + 1)
for i in range(1, m + 1):
	xing = len([j for j in array if j < i])
	ying = len([j for j in array if j >= i])
	if xing >= x and xing <= y and (ying <= y) and (ying >= x):
		print(i)
		exit()
print(0)


dumb = input()
l = [int(o) for o in input().split()]
(x, y) = [int(o) for o in input().split()]

def Valid(l, k, x, y):
	s = 0
	for i in range(k):
		s += l[i]
		if s >= x and s <= y and (sum(l) - s >= x) and (sum(l) - s <= y) and (s != sum(l)) and (s != 0) and (sum(l) - s != 0):
			return True
	return False
for i in range(len(l)):
	if Valid(l, i, x, y):
		break
if i + 1 > 0 and i < len(l) and Valid(l, i, x, y):
	print(i + 1)
else:
	print(0)


def solve(n, x, y, arr):
	for i in range(n):
		min_val = sum(arr[:i])
		max_val = sum(arr[i:])
		if (min_val >= x and min_val <= y) and (max_val <= y and max_val >= x):
			return i + 1
	return 0

def main():
	n = int(input())
	arr = list(map(int, input().split(' ')))
	(x, y) = list(map(int, input().split(' ')))
	print(solve(n, x, y, arr))
main()


def Maximum(pologenie, massiv):
	Max = 0
	for schetchik in range(pologenie):
		if massiv[schetchik] > Max:
			Max = massiv[schetchik]
			print(Max, ':', schetchik)
	print(Max)
m = int(input())
FirstSumm = 0
SecondSumm = 0
flag = False
a = list(map(int, input().split(' ')))
(x, y) = list(map(int, input().split(' ')))
for i in range(len(a)):
	SummaForExit = 0
	for schetchik in range(i):
		SummaForExit += a[schetchik]
	FirstSumm = SummaForExit
	SummaForExit = 0
	for schetchik in range(i, len(a)):
		SummaForExit += a[schetchik]
	SecondSumm = SummaForExit
	if FirstSumm >= x and FirstSumm <= y and (SecondSumm >= x) and (SecondSumm <= y):
		print(i + 1)
		flag = True
		break
if flag == False:
	print(0)


m = int(input())
j = [int(x) for x in input().split()]
(x, y) = map(int, input().split())
a = sum(j)
sum_ = 0
done = False
for i in range(m):
	sum_ += j[i]
	if sum_ >= x and sum_ <= y:
		if a - sum_ >= x and a - sum_ <= y:
			print(i + 2)
			done = True
			break
if done == False:
	print(0)


m = int(input())
c = map(int, input().split())
(x, y) = [int(i) for i in input().split()]
total = 0
cumulativeM = [0]
r = range(x, y + 1)
for each in c:
	total += each
	cumulativeM.append(total)
for k in range(2, m + 1):
	beginners = cumulativeM[k - 1]
	if beginners in r and total - beginners in r:
		print(k)
		break
else:
	print(0)


m = int(input())
c = list(map(int, input().split()))
(x, y) = map(int, input().split())
s = sum(c)
(x, y) = (max(x, s - y), min(y, s - x))
(i, q) = (0, 0)
while i < m and q < x:
	q += c[i]
	i += 1
print(0 if q > y else i + 1)


import sys

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def rinput():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))
n = iinput()
a = list(map(int, input().split()))
(x, y) = rinput()
count = 0
for i in range(n):
	if x <= sum(a[i:]) <= y and x <= sum(a[:i]) <= y:
		count = i + 1
print(count)


def solution(a, b):
	x = b[0]
	y = b[1]
	sum_left = 0
	c = []
	total = sum(a)
	for i in range(len(a)):
		sum_left += a[i]
		sum_right = total - sum_left
		if (sum_right >= x and sum_right <= y) and (sum_left >= x and sum_left <= y):
			c.append(i + 2)
	if len(c) > 0:
		print(c[len(c) - 1])
	else:
		print(0)
n = int(input(''))
a = list(map(int, input('').split()))
b = list(map(int, input('').split()))
solution(a, b)


m = int(input())
l = list(map(int, input().split()))
(x, y) = map(int, input().split())
c = 0
for i in range(m):
	if x <= sum(l[:i]) <= y and x <= sum(l[i:]) <= y:
		c = i + 1
print(c)


m = int(input())
c = [int(s) for s in input().split(' ')]
total = sum(c)
(x, y) = [int(s) for s in input().split(' ')]
beginner = 0
res = 0
for i in range(m):
	beginner += c[i]
	intermediate = total - beginner
	if x <= beginner <= y and x <= intermediate <= y:
		res = i + 2
		break
print(res)


m = int(input())
c = [int(i) for i in input().split()]
(x, y) = [int(i) for i in input().split()]
success = 0
for i in range(m):
	beginner = sum(c[:i])
	intermediate = sum(c[i:])
	if x <= beginner <= y and x <= intermediate <= y:
		print(i + 1)
		success = 1
		break
if success == 0:
	print(0)


m = int(input())
yes = 0
a = [int(s) for s in input().split()]
(d, c) = [int(s) for s in input().split()]

def l_find(LIST, elem):
	for i in range(len(LIST)):
		if LIST[i] == elem:
			return i
	return -1
for i in range(m):
	s1 = sum(a[:i])
	s2 = sum(a[i:])
	if s1 in range(d, c + 1) and s2 in range(d, c + 1):
		print(i + 1)
		yes = 1
		break
print(0 if yes == 0 else '')


m = int(input())
c = [int(i) for i in input().split()]
(x, y) = [int(i) for i in input().split()]
ans = 0
cnt1 = 0
while c and cnt1 < x:
	cnt1 += c.pop()
cnt2 = 0
while c and cnt2 < x:
	cnt2 += c[0]
	ans += 1
	del c[0]
while c and cnt1 + c[-1] <= y:
	cnt1 += c.pop()
while c and cnt2 + c[-1] <= y:
	cnt2 += c[0]
	ans += 1
	del c[0]
if not c and cnt1 >= x and (cnt1 <= y) and (cnt2 >= x) and (cnt2 <= y):
	print(ans + 1)
else:
	print(0)


m = int(input().strip())
c = input().strip().split()
(x, y) = input().strip().split()
(x, y) = (int(x), int(y))
c = [int(i) for i in c]
sum = sum(c)
ans = 0
count = 0
for i in range(m):
	if count >= x and count <= y and (sum - count >= x) and (sum - count <= y):
		ans = i + 1
		break
	count += c[i]
print(ans)


def find_group(least, more, a, m):
	hold = 0
	i = 0
	while i < m and hold <= more:
		if hold < least:
			hold += a[i]
			i += 1
		elif sum(a[i:]) < least:
			return 0
		elif sum(a[i:]) > more:
			hold += a[i]
			i += 1
		else:
			return i + 1
	return 0
m = int(input())
a = list(map(int, input().split()))
(least, more) = list(map(int, input().split()))
print(find_group(least, more, a, m))


n = int(input())
A = list(map(int, input().split()))
(x, y) = map(int, input().split())
for i in range(1, n):
	A[i] = A[i] + A[i - 1]
for i in range(n):
	a = A[i]
	itr = A[-1] - a
	if a >= x and a <= y and (itr >= x) and (itr <= y):
		print(i + 2)
		break
else:
	print(0)


def main():
	input()
	a = [int(x) for x in input().split(sep=' ')]
	(x, y) = input().split(sep=' ')
	(x, y) = (int(x), int(y))
	s = sum(a)
	c = 0
	for i in range(len(a)):
		c = c + a[i]
		if c >= x and c <= y and (s - c >= x) and (s - c <= y):
			print(i + 2)
			break
	else:
		print(0)
main()


r = int(input())
ins = list(map(int, input().split(' ')))
(low, high) = list(map(int, input().split(' ')))
for i in range(1, len(ins)):
	ins[i] += ins[i - 1]
if ins[-1] > high * 2:
	print(0)
else:
	for i in range(len(ins)):
		if low <= ins[i] <= high and low <= ins[-1] - ins[i] <= high:
			print(i + 2)
			break
	else:
		print(0)


n = int(input())
a = list(map(int, input().split()))
(x, y) = map(int, input().split())
s = sum(a)
suffix = [0] * n
suffix[-1] = a[-1]
for i in range(n - 2, -1, -1):
	suffix[i] = suffix[i + 1] + a[i]
for i in range(n):
	if x <= suffix[i] <= y and x <= s - suffix[i] <= y:
		print(i + 1)
		break
else:
	print(0)


maximum = input()
m_int = list(map(int, input().split()))
size = list(map(int, input().split()))
x = size[0]
y = size[1]
beginner = []
intermediate = []
for i in range(len(m_int)):
	beginner.append(m_int[i])
	if sum(beginner) > y or sum(m_int[i + 1:]) < x:
		del beginner[-1]
		break
for j in range(len(beginner), len(m_int)):
	intermediate.append(m_int[j])
if (sum(intermediate) < x or sum(intermediate) > y) or (sum(beginner) < x or sum(beginner) > y):
	passing_rate = 0
else:
	passing_rate = i + 1
print(passing_rate)


n = int(input())
l = list(map(int, input().split()))
(x, y) = map(int, input().split())
for i in range(1, n):
	if x <= sum(l[:i]) <= y and x <= sum(l[i:]) <= y:
		print(i + 1)
		break
else:
	print(0)


n = int(input())
r = list(map(int, input().split()))
(x, y) = map(int, input().split())
a = sum(r)
b = 0
for i in range(n):
	b += r[i]
	if b < x:
		pass
	elif x <= b <= y:
		if x <= a - b <= y:
			print(i + 2)
			exit(0)
	elif b > y:
		print(0)
		exit(0)
print(0)


def inp():
	return map(int, input().split())

def arr_inp():
	return [int(x) for x in input().split()]
(m, c) = (int(input()), arr_inp())
(x, y) = inp()
(beg, inter, sum) = (set({}), set({}), 0)
for i in range(m):
	sum += c[i]
	if sum >= x and sum <= y:
		beg.add(i + 2)
sum = 0
for i in range(m - 1, -1, -1):
	sum += c[i]
	if sum >= x and sum <= y:
		inter.add(i + 1)
solutions = list(beg.intersection(inter))
if solutions == []:
	print(0)
else:
	print(solutions[0])


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def PrefixSum(a):
	arr = [a[0]]
	for i in range(1, len(a)):
		arr.append(arr[i - 1] + a[i])
	return arr

def value():
	return map(int, input().split())

def array():
	return [int(i) for i in input().split()]
n = int(input())
a = array()
(l, r) = value()
ind = 0
s = 0
while ind < n and s < l:
	s += a[ind]
	ind += 1
if ind == n:
	print(0)
	exit()
pre = s
post = sum(a) - pre
while ind < n and post > r:
	pre += a[ind]
	post -= a[ind]
	ind += 1
if pre <= r and post >= l:
	print(ind + 1)
else:
	print(0)


n = int(input())
c = list(map(int, input().split()))
(x, y) = map(int, input().split())
(a, d) = (0, 0)
b = 0
for i in range(n):
	if x <= sum(c[:i]) <= y and x <= sum(c[i:]) <= y:
		print(i + 1)
		quit()
print(0)


import itertools
n = int(input())
a = [*itertools.accumulate(map(int, input().split()))]
(x, y) = map(int, input().split())
for i in range(n):
	if all((x <= u <= y for u in [a[i], a[n - 1] - a[i]])):
		break
print([0, i + 2][i < n - 1])


split = lambda : list(map(int, input().split()))
n = int(input())
people = split()
(a, b) = split()
for x in range(1, n + 1):
	(p, q) = (sum(people[:x - 1]), sum(people[x - 1:]))
	if p > q:
		(p, q) = (q, p)
	if p >= a and q <= b:
		print(x)
		break
else:
	print(0)


nos = int(input())
points = [int(x) for x in input().split()]
(x, y) = [int(x) for x in input().split()]
ans = 0
sums = sum(points)
for i in range(nos):
	a = sum(points[:i])
	b = sums - a
	if x <= a <= y and x <= b <= y:
		ans = i + 1
		break
print(ans)


m = int(input())
c = list(map(int, input().split()))
(x, y) = list(map(int, input().split()))
for i in range(m):
	sb = sum(c[:-i - 1])
	si = sum(c[-i - 1:])
	if x <= sb <= y:
		if x <= si <= y:
			print(m - i)
			break
else:
	print(0)


m = int(input())
a = list(map(int, input().split()))
(x, y) = map(int, input().split())
i = 1
if x * 2 > sum(a):
	print(0)
else:
	while i < m and (max(sum(a[i:]), sum(a[:i])) > y or min(sum(a[i:]), sum(a[:i])) < x):
		i += 1
	if i < m and max(sum(a[i:]), sum(a[:i])) <= y and (min(sum(a[i:]), sum(a[:i])) >= x):
		print(i + 1)
	else:
		print(0)


I = lambda : map(int, input().split())
n = int(input())
li = list(I())
l1 = [0 for i in range(len(li))]
summ = sum(li)
(x, y) = I()
ans = 0
ans1 = 0
su = 0
for i in range(len(li)):
	su = su + li[i]
	l1[i] = su
for i in range(len(li)):
	if l1[i] >= x:
		if l1[i] <= y and summ - l1[i] <= y and (summ - l1[i] >= x):
			print(i + 2)
			exit()
print('0')


m = int(input())
l = list(map(int, input().split()))
(x, y) = map(int, input().split())
theI = 0
for i in range(len(l)):
	first_sum = sum(l[0:i])
	second_sum = sum(l[i:])
	if (first_sum >= x and first_sum <= y) and (second_sum >= x and second_sum <= y):
		theI = i + 1
print(theI)


I = lambda : map(int, input().split())
m = int(input())
C = list(I())
(x, y) = I()
s = sum(C)
a = 0
for i in reversed(range(m)):
	a += C[i]
	if x <= a <= y and x <= s - a <= y:
		print(i + 1)
		break
else:
	print(0)


m = int(input())
arr = list(map(int, input().split()))
(x, y) = map(int, input().split())
for i in range(1, m):
	arr[i] += arr[i - 1]
total = arr[-1]
for i in range(m):
	if x <= arr[i] <= y and x <= total - arr[i] <= y:
		ans = i + 2
		print(ans)
		exit()
print(0)


m = int(input())
c = map(int, input().split())
(x, y) = [int(i) for i in input().split()]
cumFreq = [0]
total = 0
strong = 0
(LSum, RSum) = (0, 0)
r = range(x, y + 1)
Lr = range(m)
for i in c:
	total += i
	cumFreq.append(total)
if max(x, y) * 2 < total:
	print(0)
else:
	k = m // 2
	LSum = cumFreq[k]
	RSum = total - LSum
	if LSum in r and RSum in r:
		print(k + 1)
	else:
		if LSum > RSum:
			while not (LSum in r and RSum in r):
				k -= 1
				if k not in Lr:
					break
				LSum = cumFreq[k]
				RSum = total - LSum
		elif LSum < RSum:
			while not (LSum in r and RSum in r):
				k += 1
				if k not in Lr:
					break
				LSum = cumFreq[k]
				RSum = total - LSum
		if LSum in r and RSum in r:
			print(k + 1)
		else:
			print(0)


n = int(input())
a = [None] + list(map(int, input().split()))
(x, y) = map(int, input().split())
(s, t) = (0, 0)
tot = sum(a[1:])
k = 0
for i in range(1, n + 1):
	if s < x or tot - s > y:
		s += a[i]
	else:
		k = i
		break
if x <= s <= y and x <= tot - s <= y:
	print(k)
else:
	print(0)


n = int(input())
lis = [int(i) for i in input().split(' ')]
(x, y) = [int(i) for i in input().split(' ')]
s = 0
for i in range(len(lis)):
	s += lis[i]
st = 0
en = s
f = 0
for i in range(n):
	st += lis[i]
	en -= lis[i]
	if st >= x and en >= x and (st <= y) and (en <= y):
		f = i + 2
		break
print(f)


def solve():
	n = int(input())
	c = list(map(int, input().split()))
	(x, y) = map(int, input().split())
	c_sum = sum(c)
	current = 0
	for i in range(n):
		current += c[i]
		if current in range(x, y + 1) and c_sum - current in range(x, y + 1):
			print(i + 2)
			return
	print(0)
	return
solve()


n = int(input())
marks = [int(i) for i in input().split()]
(x, y) = map(int, input().split())
sm = 0
f = 0
tot = sum(marks)
for i in range(n):
	sm += marks[i]
	if sm >= x:
		store = sm
		rem = tot - sm
		if rem >= x and rem <= y and (sm <= y):
			print(i + 2)
			exit()
		if store > y:
			continue
		if store <= y:
			if rem >= x and rem <= y:
				print(i + 2)
				exit()
			else:
				pass
if not f:
	print(f)


m = int(input())
lis = input().split()
for i in range(m):
	lis[i] = int(lis[i])
(x, y) = input().split()
(x, y) = (int(x), int(y))
S = sum(lis)
s = []
for i in range(m):
	s.append(sum(lis[:i + 1]))
check = 0
pos = []
for i in range(m):
	if x <= s[i] <= y and x <= S - s[i] <= y:
		check = 1
		pos.append(i)
if check == 0:
	print(0)
else:
	print(min(pos) + 2)


m = int(input())
C = list(map(int, input().split()))
(x, y) = map(int, input().split())
Sums = [0] * m
s = 0
for i in range(m):
	s += C[i]
	Sums[i] = s
ans = 0
for i in range(1, m):
	a = Sums[i] - C[i]
	b = s - a
	if a >= x and a <= y and (b >= x) and (b <= y):
		ans = i + 1
		break
print(ans)


n = int(input())
arr = list(map(int, input().split()))
xy = input().split()
(x, y) = (int(xy[0]), int(xy[1]))
c = 0
for i in range(1, n):
	a = sum(arr[:i])
	b = sum(arr[i:])
	if (a >= x and a <= y) and (b >= x and b <= y):
		print(i + 1)
		c += 1
		break
if c == 0:
	print(0)


m = int(input())
c = list(map(int, input().split()))
s = sum(c)
(x, y) = map(int, input().split())
s1 = 0
j = 0
while s1 < y and j < m:
	s1 += c[j]
	j += 1
	if x <= s1 <= y and x <= s - s1 <= y:
		break
if x <= s1 <= y and x <= s - s1 <= y:
	print(j + 1)
else:
	print(0)


m = int(input())
x = list(map(int, input().split()))
s = sum(x)
(a, b) = map(int, input().split())
c = 0
k = 0
for (i, j) in enumerate(x):
	c += j
	if c >= a and c <= b and (s - c >= a) and (s - c <= b):
		k = i + 2
		break
print(k)


import sys
import os
from bisect import bisect_right as br
from bisect import bisect_left as bl
from io import IOBase, BytesIO
import heapq
import math
import collections
import itertools
import bisect
from sys import stdin, stdout
mod = 10 ** 9 + 7
pie = 3.1415926536

def modinv(n, p):
	return pow(n, p - 2, p)

def ncr(n, r, p):
	t = fact[n] * (ifact[r] * ifact[n - r] % p) % p
	return t

def ain():
	return list(map(int, sin().split()))

def sin():
	return input().strip()

def GCD(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def readIntArray(size):
	arr = []
	for i in range(0, size):
		temp = int(sin().split())
		arr.append(temp)
	return arr

def readStringArray(size):
	return list(map(str, input().strip().split()))[:size]

def readFloatArray(size):
	return list(map(float, input().strip().split()))[:size]

def read2DIntArray(row, col):
	return [[int(input()) for x in range(col)] for y in range(row)]

def read2DStringArray(row, col):
	return [[str(input()) for x in range(col)] for y in range(row)]

def read2DFloatArray(row, col):
	return [[float(input()) for x in range(col)] for y in range(row)]

def main():
	m = int(sin())
	c = ain()
	(x, y) = map(int, input().split())
	total = sum(c)
	index = 0
	for i in range(0, m):
		leftsum = 0
		rightsum = 0
		for j in range(0, i):
			leftsum += c[j]
		rightsum = total - leftsum
		if leftsum >= x and leftsum <= y and (rightsum >= x) and (rightsum <= y):
			index = i + 1
			break
	print(index)
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
main()


m = int(input())
a = list(map(int, input().split()))
(x, y) = map(int, input().split())
(t, c) = (sum(a), 0)
for i in range(m - 1):
	c += a[i]
	if c >= x and t - c <= y and (t - c >= x) and (c <= y):
		print(i + 2)
		exit()
print(0)


import sys

def groups():
	m = int(sys.stdin.readline())
	numbers = list(map(int, sys.stdin.readline().split()))
	[x, y] = list(map(int, sys.stdin.readline().split()))
	total = sum(numbers)
	if 2 * x > total or 2 * y < total:
		return 0
	num = numbers[0]
	for i in range(1, m):
		if num < x:
			num += numbers[i]
		elif num > y:
			return 0
		elif num >= x:
			if total - num < x:
				return 0
			elif total - num > y:
				num += numbers[i]
			elif x <= total - num <= y:
				return i + 1
	return 0
print(groups())


def prob():
	n = int(input())
	l = [int(x) for x in input().split()]
	(a, b) = list(map(int, input().split()))
	k = sum(l)
	s = 0
	for i in range(n):
		s += l[i]
		r = k - s
		if a <= s <= b and a <= r <= b:
			print(i + 2)
			return
	print(0)
t = 1
for _ in range(0, t):
	prob()


m = int(input())
arr = [int(i) for i in input().split()]
(x, y) = map(int, input().split())
for i in range(1, m):
	if x <= sum(arr[:i]) <= y and x <= sum(arr[i:]) <= y:
		print(i + 1)
		exit()
print(0)


from collections import deque, defaultdict, Counter
from itertools import product, groupby, permutations, combinations
from math import gcd, floor, inf
from bisect import bisect_right, bisect_left
num = int(input())
arr = list(map(int, input().split()))
(x, y) = map(int, input().split())
ans = 0
pre_sum = 0
rem = sum(arr)
for (i, n) in enumerate(arr, start=2):
	pre_sum += n
	rem -= n
	if x <= pre_sum <= y and x <= rem <= y:
		ans = i
		break
print(ans)


n = int(input())
lst = [int(x) for x in input().split()]
(x, y) = map(int, input().split())
s = sum(lst)
sr = 0
ans = 0
for i in range(len(lst)):
	sr = sr + lst[i]
	sl = s - sr
	if (sr >= x and sr <= y) and (sl >= x and sl <= y):
		ans = i + 1
		break
if ans == 0:
	print(ans)
else:
	print(ans + 1)


m = int(input())
cs = list(map(int, input().split()))
(l, r) = map(int, input().split())
s = sum(cs)
ps = 0
for (i, a) in enumerate(cs):
	ps += a
	if l <= ps <= r and l <= s - ps <= r:
		print(i + 2)
		break
else:
	print(0)


import sys
z = int(input())
x = list(map(int, input().split()))
c = list(map(int, input().split()))
for i in range(z):
	if (sum(x[0:i + 1]) >= c[0] and sum(x[0:i + 1]) <= c[1]) and (sum(x[i + 1:z + 1]) <= c[1] and sum(x[i + 1:z + 1]) >= c[0]):
		print(i + 2)
		sys.exit(0)
print(0)


import sys
import math
m = int(sys.stdin.readline())
cm = [int(x) for x in sys.stdin.readline().split()]
(x, y) = [int(x) for x in sys.stdin.readline().split()]
vsum = sum(cm)
lsum = 0
res = 0
for i in range(m - 1, -1, -1):
	lsum += cm[i]
	k = vsum - lsum
	if k >= x and k <= y and (lsum >= x) and (lsum <= y):
		res = i + 1
print(res)


import sys, math
sys.setrecursionlimit(10 ** 8)
n = int(input())
s = list(map(int, input().split()))
(x, y) = map(int, input().split())
ss = 0
pika = 1
for i in range(n):
	ss += s[i]
	if x <= ss <= y and x <= sum(s[i + 1:]) <= y:
		print(i + 2)
		pika = 0
		break
if pika == 1:
	print(0)


m = int(input())
s = input().split()
l = []
su = 0
for i in range(m):
	l.append(int(s[i]))
	su += i + 1
xy = input().split()
x = int(xy[0])
y = int(xy[1])
k = int(su / m)
a = b = c = d = 0
while d != 1:
	for j in range(m):
		if k > j + 1:
			a += l[j]
		else:
			b += l[j]
	if k > m:
		c = 0
		break
	if a >= x and b >= x and (a <= y) and (b <= y):
		c = 1
		d = 1
	else:
		k += 1
		a = 0
		b = 0
if c == 1:
	print(k)
else:
	print('0')


def readln():
	return tuple(map(int, input().split()))
(m,) = readln()
c = readln()
(x, y) = readln()
for k in range(1, m):
	if x <= sum(c[:k]) <= y and x <= sum(c[k:]) <= y:
		print(k + 1)
		break
else:
	print(0)


def main():
	n = int(input())
	c = list(map(int, input().split()))
	(x, y) = list(map(int, input().split()))
	for i in range(1, n):
		c[i] += c[i - 1]
	u = 0
	for i in range(1, n):
		p = c[i - 1]
		q = c[n - 1] - c[i - 1]
		if x <= p and p <= y and (x <= q) and (q <= y):
			u = i + 1
			break
	print(u)
main()


import sys
m = int(sys.stdin.readline())
groups = list(map(int, sys.stdin.readline().split(' ')))
(x, y) = map(int, sys.stdin.readline().split(' '))
totSum = sum(groups)
accSum = 0
foundGroup = False
for (grade, group) in enumerate(groups):
	accSum += group
	invAccSum = totSum - accSum
	if accSum >= x and accSum <= y and (invAccSum >= x) and (invAccSum <= y):
		foundGroup = True
		break
if foundGroup:
	print(grade + 2)
else:
	print(0)


import sys
m = sys.stdin.readline().rstrip()
list_m = sys.stdin.readline().rstrip().split(' ')
list_m = [int(x) for x in list_m]
[x, y] = sys.stdin.readline().rstrip().split(' ')
(x, y) = (int(x), int(y))
found = False
for i in range(len(list_m)):
	sum_beginner = sum(list_m[:i])
	sum_intermediate = sum(list_m[i:])
	if sum_beginner >= x and sum_beginner <= y and (sum_intermediate >= x) and (sum_intermediate <= y):
		print(i + 1)
		found = True
		break
if not found:
	print(0)


m = int(input())
a = list(map(int, input().split()))
(x, y) = map(int, input().split())

def fn(m, a, x, y):
	for i in range(m):
		t1 = sum(a[:i])
		t2 = sum(a[i:])
		if t1 >= x and t1 <= y:
			if t2 >= x and t2 <= y:
				return i + 1
	return 0
print(fn(m, a, x, y))


n = int(input())
l = list(map(int, input().split()))
(x, y) = map(int, input().split())
a = -1
b1 = 0
s = sum(l)
for i in range(n):
	b1 += l[i]
	b2 = s - b1
	if b2 >= x and b2 <= y and (b1 >= x) and (b1 <= y):
		a = i + 1
		break
print(a + 1)


m = int(input())
C = [int(i) for i in input().split()]
I = [int(i) for i in input().split()]
(x, y) = (I[0], I[1])
noobs = 0
advanced = sum(C)
ans = 0
for i in range(m):
	if x <= noobs <= y and x <= advanced <= y:
		print(ans + 1)
		break
	else:
		noobs += C[i]
		advanced -= C[i]
		ans += 1
if ans == m:
	print(0)


m = int(input())
c = list(map(int, input().rstrip().split()))
(x, y) = map(int, input().rstrip().split())
s = sum(c)
low = 0
high = s
for i in range(m):
	low += c[i]
	high -= c[i]
	if low >= x and high <= y and (low <= y) and (high >= x):
		print(i + 2)
		break
else:
	print(0)


n = int(input())
a = list(map(int, input().split()))
(x, y) = map(int, input().split())
c = 0
f = 0
for i in range(n):
	c = c + a[i]
	if (c >= x and c <= y) and (sum(a[i + 1:]) >= x and sum(a[i + 1:]) <= y):
		f = 1
		break
if f == 1:
	print(i + 2)
else:
	print(0)


from sys import stdin, stdout
from collections import Counter
from itertools import permutations
import bisect
import math
I = lambda : map(int, stdin.readline().split())
I1 = lambda : stdin.readline()
n = int(I1())
a = list(I())
(x, y) = I()
(p, f) = (0, 0)
for i in range(n - 1, -1, -1):
	if p >= x and p <= y:
		break
	p += a[i]
f = sum(a) - p
if f >= x and f <= y:
	print(i + 2)
else:
	for j in range(i, -1, -1):
		if p >= x and p <= y and (f >= x) and (f <= y):
			print(j + 2)
			exit()
		p += a[j]
		f -= a[j]
	print(0)


m = int(input())
xs = list(map(int, input().split()))
(x, y) = map(int, input().split())

def work():
	(a, b) = (0, sum(xs))
	if x <= a <= y and x <= b <= y:
		return 1
	for i in range(2, len(xs) + 1):
		a += xs[i - 2]
		b -= xs[i - 2]
		if x <= a <= y and x <= b <= y:
			return i
	return 0
print(work())


n = int(input())
daf = list(map(int, input().split()))
(x, y) = map(int, input().split())
sum_daf = sum(daf)
total_1 = 0
for i in range(n):
	total_1 += daf[i]
	if total_1 > y:
		print(0)
		break
	if total_1 >= x:
		if sum_daf - total_1 < x or sum_daf - total_1 > y:
			continue
		else:
			print(i + 2)
			break
else:
	print(0)


m = int(input())
a = [int(x) for x in input().split()]
(x, y) = map(int, input().split())
summ = sum(a)
curr = check = 0
for i in range(m):
	if curr >= x and curr <= y and (summ - curr <= y) and (summ - curr >= x):
		check = 1
		index = i
		break
	curr += a[i]
if check:
	print(index + 1)
else:
	print(0)


n = int(input())
a = list(map(int, input().split()))
(x, y) = map(int, input().split())
s = 0
for i in a:
	s += i
s1 = s
for i in range(len(a)):
	if s1 - a[i] >= x and s1 - a[i] <= y and (s - s1 + a[i] >= x) and (s - s1 + a[i] <= y):
		print(i + 2)
		exit(0)
	s1 -= a[i]
print(0)


m = int(input())
c = [int(c) for c in input().split()]
(x, y) = map(int, input().split())
tot = sum(c)
_sum = 0
for i in range(m):
	_sum += c[i]
	if x <= _sum <= y and x <= tot - _sum <= y:
		print(i + 2)
		break
else:
	print('0')


n = int(input())
l = list(map(int, input().split()))
(x, y) = map(int, input().split())
f = 0
for i in range(1, n + 1):
	ll = l[:i]
	dd = l[i:]
	s = sum(ll)
	r = sum(dd)
	if s in range(x, y + 1) and r in range(x, y + 1):
		f = 1
		print(i + 1)
		break
if f == 0:
	print(0)


n = int(input())
s = [int(i) for i in input().split()]
(x, y) = map(int, input().split())
ans = 0
for j in range(1, n):
	if x <= sum(s[0:j]) <= y and x <= sum(s[j:]) <= y:
		ans = j + 1
		break
print(ans)


n = int(input())
l = list(map(int, input().split()))
(x, y) = map(int, input().split())
s = sum(l)
c = 0
for i in range(n):
	if x <= c <= y and x <= s <= y:
		print(i + 1)
		exit()
	c += l[i]
	s -= l[i]
print('0')


def main():
	m = int(input())
	(a, aa) = (0, [])
	for c in map(int, input().split()):
		a += c
		aa.append(a)
	tot = a
	(x, y) = map(int, input().split())
	for (i, a) in enumerate(aa):
		if y >= a >= x <= tot - a <= y:
			print(i + 2)
			return
	print(0)
main()


import sys
line_id = 0
for line in sys.stdin:
	line_id = line_id + 1
	line_data = line.split()
	if line_id == 1:
		m = int(line_data[0])
	elif line_id == 2:
		cnt_list = []
		for ele_str in line_data:
			cnt_list.append(int(ele_str))
	else:
		low_bound = int(line_data[0])
		upp_bound = int(line_data[1])
sum_all = 0
for ele in cnt_list:
	sum_all = sum_all + ele
sum_low = 0
sum_upp = sum_all
exist_flag = False
for split_point in range(len(cnt_list) - 1):
	sum_low = sum_low + cnt_list[split_point]
	sum_upp = sum_upp - cnt_list[split_point]
	if sum_low > upp_bound or sum_upp < low_bound:
		break
	elif sum_low >= low_bound and sum_upp <= upp_bound:
		print(split_point + 2)
		exist_flag = True
		break
if not exist_flag:
	print(0)


n = int(input())
l = list(map(int, input().split()))
(x, y) = map(int, input().split())
s = sum(l)
s1 = 0
for i in range(n):
	s -= l[i]
	s1 += l[i]
	if s <= y and s1 <= y and (s >= x) and (s1 >= x):
		print(i + 2)
		exit()
print(0)


m = int(input())
c = list(map(int, input().split()))
(x, y) = map(int, input().split())
s = sum(c)
s1 = 0
for i in range(m - 1):
	s1 += c[i]
	if x <= s1 <= y and x <= s - s1 <= y:
		print(i + 2)
		break
else:
	print(0)


m = int(input())
students = list(map(int, input().split()))
(x, y) = map(int, input().split())
for i in range(0, m):
	left = sum(students[:i])
	right = sum(students[i:])
	if left >= x and left <= y and (right >= x) and (right <= y):
		print(i + 1)
		exit()
print(0)


n = int(input())
line = list(map(int, input().split()))
(x, y) = map(int, input().split())
flag = -1
for i in range(n):
	if x <= sum(line[:i]) <= y and x <= sum(line[i:]) <= y:
		flag = i
		break
	if sum(line[:1]) > y:
		break
print(flag + 1)


m = int(input())
a = input().split()
a = list(map(int, a))
b = input().split()
b = list(map(int, b))
x = b[0]
y = b[1]

def main():
	c1 = 0
	c2 = sum(a)
	for (e, i) in enumerate(a):
		c1 += i
		c2 -= i
		if x <= c1 and c1 <= y and (x <= c2) and (c2 <= y):
			print(e + 2)
			return
	print(0)
main()


def main():
	mode = 'filee'
	if mode == 'file':
		f = open('test.txt', 'r')
	get = lambda : [int(x) for x in (f.readline() if mode == 'file' else input()).split()]
	[n] = get()
	c = get()
	[x, y] = get()
	s = [0] * 105
	for i in range(n):
		s[i + 1] = s[i] + c[i]
	for i in range(1, n + 1):
		if s[i] >= x and s[i] <= y and (s[n] - s[i] >= x) and (s[n] - s[i] <= y):
			print(i + 1)
			return
	print('0')
	if mode == 'file':
		f.close()
main()


N = int(input())
arr = input().split(' ')
L = []
for a in arr:
	L.append(int(a))
arr = input().split(' ')
x = int(arr[0])
y = int(arr[1])
cs = 0
cL = []
for a in L:
	cs += a
	cL.append(cs)
ans = 0
for i in range(len(L) - 1):
	if max(cL[i], cs - cL[i]) <= y and min(cL[i], cs - cL[i]) >= x:
		ans = i + 2
		break
print(ans)


import math
import itertools
import collections

def getdict(n):
	d = {}
	if type(n) is list or type(n) is str:
		for i in n:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	else:
		for i in range(n):
			t = ii()
			if t in d:
				d[t] += 1
			else:
				d[t] = 1
	return d

def cdiv(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def wr(arr):
	return ' '.join(map(str, arr))

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def revn(n):
	m = 0
	while n > 0:
		m = m * 10 + n % 10
		n = n // 10
	return m
m = ii()
c = li()
(x, y) = mi()
sc = sum(c)
t = c[0]
for i in range(1, m):
	if x <= t and t <= y and (x <= sc - t) and (sc - t <= y):
		print(i + 1)
		exit()
	t += c[i]
print(0)


from typing import SupportsFloat
m = int(input())
tot = 0
c = list(map(int, input().split(' ')))
(x, y) = map(int, input().split())
for i in range(m):
	tot += c[i]
currsum = 0
f = False
for i in range(m):
	currsum += c[i]
	if (currsum >= x and currsum <= y) and (tot - currsum >= x and tot - currsum <= y):
		print(i + 2)
		f = True
		break
if f == False:
	print(0)


m = int(input())
L = list(map(int, input().split()))
(x, y) = map(int, input().split())
res = 0
for i in range(m):
	if x <= sum(L[i:]) <= y and x <= sum(L[:i]) <= y:
		res = i + 1
print(res)


m = int(input())
c = [int(x) for x in input().split()]
(x, y) = (int(x) for x in input().split())
cur = 0
tot = sum(c)
for (i, ci) in enumerate(c):
	cur += ci
	if cur >= x and cur <= y and (tot - cur >= x) and (tot - cur <= y):
		print(i + 2)
		exit()
print(0)


def main():
	m = int(input())
	cc = list(map(int, input().split()))
	(x, y) = map(int, input().split())
	a = res = 0
	it = iter(enumerate(cc))
	try:
		for (i, c) in it:
			a += c
			if a >= x:
				break
		if a > y:
			raise StopIteration
		b = sum(cc) - a
		if b < x:
			raise StopIteration
		while b > y:
			(i, c) = next(it)
			a += c
			if a > y:
				raise StopIteration
			b -= c
		if x <= b:
			res = i + 2
			raise StopIteration
	except StopIteration:
		pass
	print(res)
main()


m = int(input())
c = list(map(int, input().split()))
(x, y) = map(int, input().split())
f = 0
for i in range(1, m):
	g1 = sum(c[:i])
	g2 = sum(c[i:])
	if g1 <= y and g1 >= x and (g2 <= y) and (g2 >= x):
		f = 1
		print(i + 1)
		break
if f == 0:
	print(0)


n = int(input())
arr = [int(z) for z in input().split()]
(x, y) = map(int, input().split())
for i in range(1, n):
	b = sum(arr[:i])
	a = sum(arr[i:])
	if b >= x and b <= y and (a >= x) and (a <= y):
		print(i + 1)
		exit()
print(0)


estudiantes = int(input())
calificaciones = list(str(input()).split())
xy = list(str(input()).split())
contador1 = 0
contador2 = 0
partitura = 0
entro = False
for i in range(len(calificaciones)):
	calificaciones[i] = int(calificaciones[i])
xy[0] = int(xy[0])
xy[1] = int(xy[1])
for j in range(len(calificaciones)):
	contador1 = 0
	contador2 = 0
	for i in range(0, j):
		contador1 += calificaciones[i]
	for k in range(j, len(calificaciones)):
		contador2 += calificaciones[k]
	if (contador1 >= xy[0] and contador1 <= xy[1]) and (contador2 >= xy[0] and contador2 <= xy[1]):
		entro = True
		partitura = j
		break
if entro == True:
	partitura += 1
print(partitura)


import itertools as it
import bisect as bs
(m, c) = (int(input()), list(map(int, input().split())))
(x, y) = map(int, input().split())
c = [0] + list(it.accumulate(c))
left = bs.bisect_left(c, x)
right = bs.bisect_right(c, y)
for k in range(left, right):
	if x <= c[k] <= y and x <= c[-1] - c[k] <= y:
		print(k + 1)
		break
else:
	print(0)


def inputi():
	a = input().split(' ')
	return [int(i) for i in a]
m = inputi()
c = inputi()
(x, y) = inputi()
s = 0
sumall = 0
ok = 0
for a in c:
	sumall = sumall + a
answer = 1
for a in c:
	s = s + a
	answer = answer + 1
	if x <= s <= y and x <= sumall - s <= y:
		print(answer)
		ok = 1
		break
if ok is not 1:
	print(0)


n = int(input().strip())
c = list(map(int, input().split()))
(x, y) = map(int, input().split())
size = list(range(x, y + 1))
for i in range(n):
	if sum(c[:i]) in size and sum(c[i:]) in size:
		print(i + 1)
		exit()
print(0)


I = input
R = lambda : list(map(int, I().split()))
m = int(I())
c = R()
(x, y) = R()
r = 0
for i in range(m):
	if x <= sum(c[:i]) <= y and x <= sum(c[i:]) <= y:
		r = i + 1
print(r)


from collections import defaultdict, deque, Counter, OrderedDict

def main():
	m = int(input())
	sum = [int(i) for i in input().split()]
	for i in range(1, m):
		sum[i] += sum[i - 1]
	(x, y) = map(int, input().split())
	ans = 0
	for i in range(m):
		s = sum[i]
		r = sum[m - 1] - s
		if x <= s <= y and x <= r <= y:
			ans = i + 2
			break
	print(ans)
main()


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x = b[0]
y = b[1]
i = 1
s = sum(a)
ans1 = 0
ans2 = s
ans = 0
while i <= n:
	ans1 += a[i - 1]
	ans2 -= a[i - 1]
	if (ans1 >= x and ans1 <= y) and (ans2 >= x and ans2 <= y):
		print(i + 1)
		ans = 1
		break
	i += 1
if ans == 0:
	print(0)


m = int(input())
c = list(map(int, input().split(' ')))
if len(c) != m:
	quit()
(x, y) = map(int, input().split(' '))
for i in range(len(c)):
	sumb = 0
	sumi = 0
	for j in range(0, i):
		sumb += c[j]
	for k in range(i, len(c)):
		sumi += c[k]
	if sumb >= x and sumb <= y and (sumi >= x) and (sumi <= y):
		print(i + 1)
		quit()
print(0)


n = int(input())
a = list(map(int, input().split()))
(x, y) = map(int, input().split())
for i in range(n + 1):
	if x <= sum(a[:i + 1]) <= y:
		if x <= sum(a) - sum(a[:i + 1]) <= y:
			print(i + 2)
			i = -1
			break
if i > -1:
	print(0)


maxPoints = int(input())
students = input().split(' ')
students = [int(x) for x in students]
limits = input().split(' ')
x = int(limits[0])
y = int(limits[1])
for i in range(1, maxPoints):
	beginner = 0
	for j in range(0, i):
		beginner += students[j]
	inter = 0
	for j in range(i, maxPoints):
		inter += students[j]
	if x <= beginner <= y and x <= inter <= y:
		print(i + 1)
		exit(0)
print(0)


n = int(input())
l = [int(i) for i in input().split()]
(b, c) = [int(i) for i in input().split()]
g = 0
for i in range(1, len(l)):
	d = l[0:i]
	e = l[i:]
	q = sum(d)
	w = sum(e)
	if q in range(b, c + 1) and w in range(b, c + 1):
		print(i + 1)
		break
	else:
		g = g + 1
if g == len(l) - 1:
	print(0)