It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.

Marmot brought Mole n ordered piles of worms such that i-th pile contains a_{i} worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a_1, worms in second pile are labeled with numbers a_1 + 1 to a_1 + a_2 and so on. See the example for a better understanding.

Mole can't eat all the worms (Marmot brought a lot) and, as we all know, Mole is blind, so Marmot tells him the labels of the best juicy worms. Marmot will only give Mole a worm if Mole says correctly in which pile this worm is contained.

Poor Mole asks for your help. For all juicy worms said by Marmot, tell Mole the correct answers.


-----Input-----

The first line contains a single integer n (1 ≤ n ≤ 10^5), the number of piles.

The second line contains n integers a_1, a_2, ..., a_{n} (1 ≤ a_{i} ≤ 10^3, a_1 + a_2 + ... + a_{n} ≤ 10^6), where a_{i} is the number of worms in the i-th pile.

The third line contains single integer m (1 ≤ m ≤ 10^5), the number of juicy worms said by Marmot.

The fourth line contains m integers q_1, q_2, ..., q_{m} (1 ≤ q_{i} ≤ a_1 + a_2 + ... + a_{n}), the labels of the juicy worms.


-----Output-----

Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number q_{i} is.


-----Examples-----
Input
5
2 7 3 4 9
3
1 25 11

Output
1
5
3



-----Note-----

For the sample input:

  The worms with labels from [1, 2] are in the first pile.  The worms with labels from [3, 9] are in the second pile.  The worms with labels from [10, 12] are in the third pile.  The worms with labels from [13, 16] are in the fourth pile.  The worms with labels from [17, 25] are in the fifth pile.

Source: codeforces | Difficulty: EASY
Tags: Sorting

Implementation


Solutions:
n = int(input())
a = [int(i) for i in input().split()]
m = int(input())
q = [int(i) for i in input().split()]
b = [a[0]]
for i in range(1, len(a)):
	b.append(a[i] + b[i - 1])
for i in range(len(q)):
	l = -1
	r = len(a)
	while r - l > 1:
		mid = (l + r) // 2
		if b[mid] < q[i]:
			l = mid
		else:
			r = mid
	print(r + 1)


from bisect import bisect_left
n = int(input())
arr = list(map(int, input().split()))
for i in range(1, n):
	arr[i] += arr[i - 1]
m = input()
for i in list(map(int, input().split())):
	print(bisect_left(arr, i) + 1)


n = int(input())
A = list(map(int, input().split()))
q = int(input())
Q = list(map(int, input().split()))
ans = []
prec = 1
iStack = 0
for ai in A:
	iStack += 1
	for query in range(prec, prec + ai):
		ans.append(iStack)
	prec = ai
for query in Q:
	print(ans[query - 1])


n = int(input())
s = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))
l = [0] * (sum(s) + 2)
x = 1
for i in range(n):
	for j in range(s[i]):
		l[x] = i + 1
		x += 1
for y in t:
	print(l[y])


n = int(input())
a = [0] + list(map(int, input().split()))
s = [0] * (n + 2)
for i in range(1, n + 1):
	s[i] = s[i - 1] + a[i]
s[-1] = s[-2] + 100
m = int(input())
q = list(map(int, input().split()))
for t in q:
	(l, r) = (0, n + 1)
	for i in range(300):
		mid = (l + r) // 2
		if s[mid - 1] < t and t <= s[mid]:
			print(mid)
			break
		elif s[mid] < t:
			l = mid + 1
		else:
			r = mid - 1


from bisect import bisect_left
n = int(input())
A = list(map(int, input().split()))
m = int(input())
Q = list(map(int, input().split()))
sum_A = list(A)
for i in range(1, n):
	sum_A[i] += sum_A[i - 1]
for q in Q:
	print(bisect_left(sum_A, q) + 1)


import bisect

def search(starts, lo, hi, value):
	return bisect.bisect(starts, value)
n = int(input())
sizes = [int(x) for x in input().split()]
starts = []
for (i, size) in enumerate(sizes):
	start = 1 if not starts else starts[i - 1] + sizes[i - 1]
	starts.append(start)
m = int(input())
values = [int(x) for x in input().split()]
for value in values:
	print(search(starts, 0, len(starts) - 1, value))


import bisect
n = int(input())
a = list(map(int, input().split()))
c = []
l = 0
for i in range(len(a)):
	l += a[i]
	c.append(l)
q = int(input())
x = list(map(int, input().split()))
for i in range(len(x)):
	t = bisect.bisect_left(c, x[i])
	print(t + 1, end=' ')


def low(brr, c, l, r):
	mid = int(l + int((r - l) / 2))
	if brr[mid] >= c and brr[mid - 1] < c:
		return int(mid + 1)
	elif brr[mid] > c:
		return int(low(brr, c, l, mid))
	elif brr[mid] < c:
		return int(low(brr, c, mid + 1, r))
n = int(input())
arr = list(map(int, input().split(' ')))
srr = list((0 for i in range(n)))
srr[0] = arr[0]
for i in range(1, n):
	srr[i] = srr[i - 1] + arr[i]
k = int(input())
brr = list(map(int, input().split(' ')))
for i in range(k):
	if brr[i] <= srr[0]:
		print(1)
	elif brr[i] > srr[n - 2]:
		print(n)
	else:
		print(low(srr, brr[i], 0, n - 1))


from sys import stdin, stdout

def bin(k, lo, hi):
	ans = 1
	while lo <= hi:
		mid = (lo + hi) // 2
		if b[mid] >= k:
			ans = mid
			hi = mid - 1
		else:
			lo = mid + 1
	return ans
a = int(stdin.readline())
b = [0] + list(map(int, stdin.readline().split()))
stdin.readline()
p = ''
o = list(map(int, stdin.readline().split()))
for i in range(1, a + 1):
	b[i] += b[i - 1]
for i in o:
	p += str(bin(i, 1, a)) + '\n'
stdout.write(p)


y = int(input())
a = list(map(int, input().split()))
b = []
for i in range(len(a)):
	for j in range(a[i]):
		b.append(i + 1)
x = int(input())
c = list(map(int, input().split()))
for h in range(len(c)):
	print(b[c[h] - 1])


n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
for i in range(1, n):
	a[i] += a[i - 1]
for x in q:
	left = 0
	right = n
	while left < right:
		mid = (left + right) // 2
		if x > a[mid]:
			left = mid + 1
		elif x <= a[mid] and (mid == 0 or x > a[mid - 1]):
			print(mid + 1)
			break
		else:
			right = mid


n = int(input())
l = [int(i) for i in input().split()]
l1 = []
k = 1
for i in range(n):
	l1 += [k] * l[i]
	k += 1
m = int(input())
q = [int(i) for i in input().split()]
for i in range(m):
	print(l1[q[i] - 1])


def search(low, high, check):
	mid = (high + low) // 2
	while high >= low:
		if check(mid):
			low = mid + 1
		else:
			high = mid - 1
		mid = (high + low) // 2
	return mid
n = int(input())
ai = list(map(int, input().split()))
m = int(input())
qi = list(map(int, input().split()))
for i in range(1, n):
	ai[i] += ai[i - 1]
worm = 0

def check(num):
	global ai
	global worm
	return ai[num] < worm
for worm in qi:
	print(search(0, n - 1, check) + 2)


t = int(input())
arr = [int(x) for x in input().split()]
t2 = int(input())
arr2 = [int(x) for x in input().split()]
arr3 = [0] * (10 ** 6 + 1)
prev = 0
c = 1
for i in range(t):
	a = arr[i]
	while a:
		arr3[c] = i
		a -= 1
		c += 1
for j in arr2:
	print(arr3[j] + 1)


def search(l, i, p1, p2):
	mid = int((p1 + p2) / 2)
	if l[mid] == i:
		return mid + 1
	elif i < l[mid]:
		if mid == 0:
			return 1
		if l[mid - 1] + 1 <= i:
			return mid + 1
		else:
			return search(l, i, p1, mid)
	elif l[mid + 1] >= i:
		return mid + 2
	else:
		return search(l, i, mid + 1, p2)
a = int(input())
k = list(map(int, input().split()))
l = []
for i in range(a):
	if len(l) == 0:
		l.append(k[i])
	else:
		l.append(k[i] + l[len(l) - 1])
n = int(input())
m = list(map(int, input().split()))
for i in range(n):
	print(search(l, m[i], 0, len(l) - 1))


r = int(input())
ra = [int(x) for x in input().split()]
j = int(input())
jf = [int(x) for x in input().split()]
dp = [0] * sum(ra)
k = 1
i = 0
j = 0
for f in range(len(dp)):
	dp[f] = k
	j += 1
	if j == ra[i]:
		j = 0
		i += 1
		k += 1
for y in range(len(jf)):
	print(dp[jf[y] - 1])


from bisect import bisect_left
from sys import stdin, stdout
lines = stdin.read().split('\n')
n = int(lines[0])
a = list(map(int, lines[1].split(' ')))
for i in range(1, len(a)):
	a[i] += a[i - 1]
m = int(lines[2])
qs = list(map(int, lines[3].split(' ')))
for q in qs:
	stdout.write(str(bisect_left(a, q) + 1) + '\n')


n = int(input())
a = [int(i) for i in input().split()]
m = int(input())
qs = [int(i) for i in input().split()]
cs = 0
pref_sums = []
for i in a:
	pref_sums.append(cs + i)
	cs += i
ans = []
for q in qs:
	l = -1
	r = n - 1
	while r - l > 1:
		m = l + (r - l) // 2
		if pref_sums[m] < q:
			l = m
		else:
			r = m
	ans.append(r + 1)
print(*ans, sep='\n')


from bisect import bisect_left
n = int(input())
arr = [int(i) for i in input().split()]
for i in range(1, n):
	arr[i] += arr[i - 1]
m = int(input())
q = [int(i) for i in input().split()]
for x in q:
	print(bisect_left(arr, x) + 1)


n = int(input())
bookCnt = list(map(int, input().split()))
m = int(input())
serialNum = list(map(int, input().split()))

def findFirstLessThan(arr, l, r, target):
	while l <= r:
		mid = (l + r) // 2
		if arr[mid] == target:
			return mid + 1
		elif arr[mid] > target:
			r = mid - 1
		else:
			l = mid + 1
	return l + 1
curSum = 0
pSum = [0] * n
for (i, v) in enumerate(bookCnt):
	curSum += v
	pSum[i] = curSum
for query in serialNum:
	print(findFirstLessThan(pSum, 0, n - 1, query))


n = int(input())
aa = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
a = [1, aa[0]]
for i in range(1, n):
	a.append(a[-1] + aa[i])
for qq in q:
	l = 0
	r = n
	while r - l > 1:
		if qq <= a[(l + r) // 2]:
			r = (l + r) // 2
		else:
			l = (l + r) // 2
	print(r)


n = int(input())
lis = [int(i) for i in input().split()]
m = int(input())
lis1 = [int(i) for i in input().split()]
c = 1
check = []
for i in lis:
	check.extend([c] * i)
	c += 1
for i in lis1:
	print(check[i - 1])


n = int(input())
l = list(map(int, input().split()))
ju = int(input())
p = list(map(int, input().split()))
for i in range(1, n):
	l[i] += l[i - 1]
l.insert(0, 0)
for i in p:
	f = 0
	r = n
	while r >= f:
		mid = (f + r) // 2
		if l[mid] == i or (i < l[mid] and i > l[mid - 1]):
			print(mid)
			break
		elif l[mid] > i and l[mid - 1] >= i:
			r = mid - 1
		else:
			f = mid + 1


from bisect import bisect_left
n = int(input())
n1 = input().split()
m = int(input())
m1 = input().split()
lista = []
valor = 0
for e in n1:
	valor += int(e)
	lista.append(valor)
for e in m1:
	print(bisect_left(lista, int(e)) + 1)


from bisect import bisect_left
n = int(input())
worms = map(int, input().split())
worms_count = [0]
for w in worms:
	worms_count.append(worms_count[-1] + w)
m = int(input())
juicy = map(int, input().split())
for j in juicy:
	print(bisect_left(worms_count, j))


n = int(input())
a = list(map(int, input().split()))
d = {}
k = 1
for i in range(n):
	for j in range(a[i]):
		d[k] = i + 1
		k += 1
m = int(input())
q = list(map(int, input().split()))
for i in range(m):
	print(d.get(q[i]))


import bisect
n = int(input())
tmp = input().split()
a = list()
order = list()
s = 1
for i in range(1, n + 1):
	s = s + int(tmp[i - 1])
	order.append(i)
	a.append(s)
m = int(input())
nums = input().split()
for i in nums:
	print(order[bisect.bisect(a, int(i))])


n = int(input())
arr = list(map(int, input().split(' ')))
m = int(input())
arr2 = list(map(int, input().split(' ')))
ans = []
for i in range(n):
	ans += [i] * arr[i]
for j in range(m):
	print(ans[arr2[j] - 1] + 1)


from bisect import bisect_left
n = int(input())
arr = [int(p) for p in input().split()]
juicyNo = int(input())
juicyArr = [int(p) for p in input().split()]
for i in range(1, len(arr)):
	arr[i] += arr[i - 1]
for i in range(len(juicyArr)):
	index = bisect_left(arr, juicyArr[i])
	print(index + 1)


n = input()
l = [int(i) for i in input().split()]
x = input()
x = [int(i) for i in input().split()]
master = []
j = 1
ans = []
for i in l:
	master += [j] * i
	j += 1
for i in x:
	ans.append(master[i - 1])
print(*ans)


n = int(input())
s = list(map(int, input().split()))
n1 = int(input())
s1 = list(map(int, input().split()))
w = []
i = -1
d = n - 1
r = 0
while i != d:
	i += 1
	for j in range(s[i]):
		r += 1
	w.append(r)
ans = []
for i in range(n1):
	(l, r) = (-1, n)
	while l + 1 < r:
		md = (l + r) // 2
		if s1[i] <= w[md]:
			r = md
		else:
			l = md
	ans.append(r + 1)
print(*ans, sep='\n')


def search(q):
	(l, r) = (0, len(a))
	while l < r:
		mid = (l + r) // 2
		if a[mid] == q:
			return mid + 1
		elif a[mid] < q:
			l = mid + 1
		else:
			r = mid
	return l + 1
n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
for i in range(1, len(a)):
	a[i] += a[i - 1]
for i in q:
	print(search(i))


def binsearch(nums, target):
	left = 0
	right = len(nums) - 1
	while left <= right:
		mid = (left + right) // 2
		if nums[mid] == target:
			return mid
		elif nums[mid] > target:
			right = mid - 1
		elif nums[mid] < target:
			left = mid + 1
	return left
n = int(input())
dorms = [int(z) for z in input().split()]
dorms1 = [0, dorms[0]]
for d in range(1, n):
	dorms1.append(dorms1[d] + dorms[d])
g = int(input())
guesses = [int(b) for b in input().split()]
for r in guesses:
	pl = binsearch(dorms1, r)
	print(pl)


from bisect import *

def read():
	return (int(x) for x in input().split())
input()
a = [0]
for x in read():
	a.append(a[-1] + x)
input()
for x in read():
	print(bisect_left(a, x))


n = int(input())
piles = [int(a) for a in input().split()]
worms = [0] * (sum(piles) + 1)
amount = 0
for x in range(n):
	for i in range(amount + 1, amount + piles[x] + 1):
		worms[i] = x + 1
	amount += piles[x]
jw = input()
for worm in [int(a) for a in input().split()]:
	print(worms[worm])


import bisect
n = int(input())
s = list(map(int, input().split()))
m = int(input())
p = list(map(int, input().split()))
a = []
count = 0
for i in range(n):
	count += s[i]
	a.append(count)
for i in p:
	print(bisect.bisect_left(a, i) + 1)


n = int(input())
cum = []
nums = list(map(int, input().split()))
m = int(input())
qs = list(map(int, input().split()))
cumsum = 0
for i in range(n):
	cumsum += nums[i]
	cum.append(cumsum)
for i in range(m):
	left = 0
	right = n - 1
	mid = 0
	while left < right:
		mid = left + (right - left) // 2
		if cum[mid] >= qs[i]:
			right = mid
		else:
			left = mid + 1
	print(left + 1)


piles = int(input())
number_of_worm_in_each_pile = [int(i) for i in input().split()]
number_of_juicy_worm = int(input())
label_of_juicy_worm = [int(i) for i in input().split()]
pile = 1
worm_repo = []
counter = 0
for i in range(piles):
	for j in range(1, number_of_worm_in_each_pile[counter] + 1):
		worm_repo.append(pile)
	pile += 1
	counter += 1
for i in label_of_juicy_worm:
	print(worm_repo[i - 1])


n1 = int(input())
var = [int(x) for x in input().split()]
sumvar = sum(var)
li = list()
li.append(0)
index = 0
arri = 0
sumTillNow = var[0]
cnt = 1
for index in range(1, sumvar + 1):
	if index <= sumTillNow:
		li.append(cnt)
	else:
		arri += 1
		sumTillNow += var[arri]
		cnt += 1
		li.append(cnt)
m = int(input())
var2 = [int(x) for x in input().split()]
for el in var2:
	print(li[el])


import bisect
n = int(input())
a = list(map(int, input().split()))
dp = [a[0]]
for i in range(1, len(a)):
	dp.append(dp[-1] + a[i])
k = int(input())
q = list(map(int, input().split()))
for i in q:
	print(bisect.bisect_left(dp, i) + 1)


import sys
input = sys.stdin.buffer.readline
a = int(input())
b = list(map(int, input().split()))
c = int(input())
d = list(map(int, input().split()))
k = []
t = [0 for x in range(10 ** 6 + 1)]
p = 1
h = 1
for y in b:
	for x in range(p, p + y):
		t[x] = h
	p += y
	h += 1
for y in d:
	print(t[y])


from bisect import bisect_left
n1 = int(input())
a = [int(i) for i in input().split()]
n2 = int(input())
c1 = [int(i) for i in input().split()]
c = []
c12 = 0
k12 = 0
lb = 0
ub = n1
mid = (lb + ub) / 2
for i in range(n1):
	c12 += a[i]
	c.append(c12)
for i in range(n2):
	b = c1[i]
	if b < c[0]:
		print(1)
	else:
		k12 = bisect_left(c, b)
		print(k12 + 1)


def func(n):
	l = list(map(int, input().split()))
	juicy = int(input())
	juicy_in = list(map(int, input().split()))
	dictionary = {}
	j = 1
	k = 1
	for i in l:
		for i in range(i):
			dictionary[j] = k
			j += 1
		k += 1
	for i in juicy_in:
		print(dictionary[i])
n = int(input())
func(n)


a = map(int, input().split())
b = list(map(int, input().split()))
c = map(int, input().split())
d = list(map(int, input().split()))
pos = 1
ans = []
for i in b:
	ans += [pos] * int(i)
	pos += 1
for j in d:
	print(ans[int(j) - 1])


input()
pos = []
aux = 1
for e in input().split():
	pos += [aux] * int(e)
	aux += 1
input()
for e in input().split():
	print(str(pos[int(e) - 1]))


n = int(input())
x = list(map(int, input().split()))
t = int(input())
y = list(map(int, input().split()))
ans = []
for i in range(len(x)):
	ans.extend([i + 1 for j in range(x[i])])
for i in y:
	print(ans[i - 1])


n = int(input())
a = [int(x) for x in input().split()]
b = [0] * (n + 1)
for i in range(1, n + 1):
	b[i] = b[i - 1] + a[i - 1]
m = int(input())
d = [0] * (b[n] + 1)
c = [int(x) for x in input().split()]
tmp = 1
for i in range(1, b[n] + 1):
	if i <= b[tmp]:
		d[i] = tmp
	else:
		tmp += 1
		d[i] = tmp
for i in range(m):
	print(d[c[i]])


from sys import stdin, stdout
cin = stdin.readline
cout = stdout.write
mp = lambda : list(map(int, cin().split()))
(n,) = mp()
a = mp()
(m,) = mp()
q = mp()
p = 1
l = [0]
for i in range(n):
	l += [p] * a[i]
	p += 1
for i in range(m):
	ans = l[q[i]]
	cout(str(ans) + '\n')


n = int(input())
worms = [int(w) for w in input().split()]
m = int(input())
juicies = list(enumerate([int(j) for j in input().split()]))
l = []
s = 0
for w in worms:
	s += w
	l.append(s)
juicies.sort(key=lambda a: a[1])
end = 0
ans = []
for (j, i) in juicies:
	while True:
		if i <= l[end]:
			ans.append((end + 1, j))
			break
		else:
			end += 1
ans.sort(key=lambda a: a[1])
for a in ans:
	print(a[0])


import bisect
n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
a1 = a[0]
l = [1, a1]
for i in range(1, n):
	l.append(a1 + 1)
	a1 = a1 + a[i]
	l.append(a1)
ans = []
for i in q:
	x = bisect.bisect(l, i)
	if x % 2 == 0:
		ans.append(x // 2)
	else:
		ans.append((x + 1) // 2)
ans = list(map(str, ans))
print('\n'.join(ans))


n = int(input())
ws = list(map(int, input().split()))
k = int(input())
jl = list(map(int, input().split()))
js = sorted(jl)
j = 0
w = 0
wcum = 0
d = dict()
while j < k:
	while True:
		if js[j] <= wcum:
			d[js[j]] = w
			j += 1
			break
		wcum += ws[w]
		w += 1
for j in jl:
	print(d[j])


import math

def inp():
	return int(input())

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

def instr():
	s = input()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())
n = inp()
a = inlist()
m = inp()
Q = inlist()
W = [0] * (sum(a) + 1)
w = 1
pile = 1
for i in range(n):
	for j in range(a[i]):
		W[w] = pile
		w += 1
	pile += 1
for q in Q:
	print(W[q])


import math

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

def bin_src(c, k):
	hi = len(c) - 1
	lo = 0
	while lo < hi:
		mid = math.floor((hi + lo) / 2)
		if k <= c[mid]:
			hi = mid
		else:
			lo = mid + 1
	return lo + 1

def main():
	sol = []
	n = int(input())
	a = list(map(int, input().split(' ')))
	m = int(input())
	r = list(map(int, input().split(' ')))
	a = prefix_sum(a)[:]
	for i in range(m):
		sol.append(bin_src(a, r[i]))
	for i in range(m):
		print(sol[i])
main()


n = int(input())
a = list(map(int, input().split()))
input()
q = list(map(int, input().split()))
k = []
for i in range(n):
	k += [i] * a[i]
for i in q:
	print(k[i - 1] + 1)


def bs(array, i):
	low = 0
	high = len(array) - 1
	while low < high:
		mid = (low + high) // 2
		if array[mid] >= i:
			high = mid
		else:
			low = mid + 1
	return low
n = int(input())
array = [int(i) for i in input().split()]
s = 0
for i in range(n):
	s += array[i]
	array[i] = s
t = int(input())
tc = [int(i) for i in input().split()]
for i in tc:
	print(bs(array, i) + 1)


n = int(input())
a = list(map(int, input().split()))
k = []
for i in range(n):
	for j in range(a[i]):
		k.append(i + 1)
m = int(input())
b = list(map(int, input().split()))
for i in b:
	print(k[i - 1])


n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = map(int, input().split())
d = dict()
a0 = 1
for i in range(n):
	for k in range(a0, a0 + a[i]):
		d[k] = i + 1
	a0 += a[i]
for u in q:
	print(d[u])


def main():
	n = int(input())
	tab = list(map(int, input().split()))
	couples = [tab[0]]
	for x in range(1, n):
		couples.append(tab[x] + couples[x - 1])
	q = int(input())
	qtab = list(map(int, input().split()))
	iqtab = []
	for x in range(q):
		iqtab.append([x, qtab[x]])
	iqtab.sort(key=lambda x: x[1])
	current_s = 0
	for x in range(q):
		while current_s < n and iqtab[x][1] > couples[current_s]:
			current_s += 1
		iqtab[x][1] = current_s + 1
	iqtab.sort(key=lambda x: x[0])
	for item in iqtab:
		print(item[1])
main()


n = int(input())
l1 = list(map(int, input().split()))
nw = int(input())
l2 = list(map(int, input().split()))
for i in range(1, n):
	l1[i] += l1[i - 1]
for i in range(nw):
	beg = 0
	end = n - 1
	while beg <= end:
		mid = (beg + end) // 2
		if l2[i] <= l1[mid]:
			if mid == 0:
				print(mid + 1)
				break
			elif l2[i] > l1[mid - 1]:
				print(mid + 1)
				break
			else:
				end = mid - 1
		else:
			beg = mid + 1


import bisect
n = int(input())
a = [int(v) for v in input().split()]
m = int(input())
q = [int(v) for v in input().split()]
for i in range(1, n):
	a[i] += a[i - 1]
for i in range(0, m):
	print(bisect.bisect_left(a, q[i]) + 1)


import bisect
from itertools import accumulate
t = int(input())
p = list(map(int, input().split()))
m = int(input())
a = list(map(int, input().split()))
b = list(accumulate(p))
for j in range(len(a)):
	print(bisect.bisect_left(b, a[j]) + 1)


n = int(input())
a = []
a.append(0)
a += list(map(int, input().strip().split()))
for i in range(2, n + 1):
	a[i] += a[i - 1]
m = int(input())
q = list(map(int, input().split()))

def search(query, pileNumber):
	if query >= a[pileNumber - 1] + 1 and query <= a[pileNumber]:
		return 1
	elif query < a[pileNumber - 1] + 1:
		return 0
	elif query > a[pileNumber]:
		return 2
for i in q:
	start = 1
	end = n
	while True:
		mid = (start + end) // 2
		ans = search(i, mid)
		if ans == 1:
			print(mid)
			break
		elif ans == 0:
			end = mid - 1
		elif ans == 2:
			start = mid + 1


L = []
r = 1
input()
for i in input().split():
	L += [r] * int(i)
	r += 1
input()
for i in input().split():
	print(L[int(i) - 1])


import sys
input = sys.stdin.readline
from itertools import accumulate as acc
from bisect import bisect_left as bl
n = int(input())
x = [0] + [*acc(map(int, input().split()))]
m = int(input())
y = [*map(int, input().split())]
z = [bl(x, i) for i in y]
print(*z, sep='\n')


a = int(input())
b = [int(x) for x in input().split()]
c = int(input())
d = [int(x) for x in input().split()]
structure = [0]
count = 1
for x in b:
	for y in range(x):
		structure.append(count)
	count += 1
for x in d:
	print(structure[x])


from bisect import *
input()
a = [int(x) for x in input().split()]
input()
q = [int(x) for x in input().split()]
for i in range(1, len(a)):
	a[i] += a[i - 1]
for x in q:
	print(bisect_left(a, x) + 1)


from bisect import bisect_left
n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
c = [a[0]]
for i in range(1, n):
	c.append(c[i - 1] + a[i])
for i in range(m):
	print(bisect_left(c, b[i]) + 1)


n = int(input())
pre = []
row = 1
for i in input().split(' '):
	for j in range(int(i)):
		pre.append(row)
	row += 1
m = int(input())
tasty_worms = []
for i in input().split(' '):
	i = int(i)
	print(pre[i - 1])


def binary(arr, k, lo=0):
	hi = len(arr)
	while lo < hi:
		mid = (lo + hi) // 2
		if arr[mid] < k:
			lo = mid + 1
		else:
			hi = mid
	return lo
n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
array = [a[0]]
for i in range(1, n):
	array.append(a[i] + array[-1])
for q in b:
	this = binary(array, q - 0.1)
	print(min(this + 1, n))


import bisect
n = input()
a = [int(x) for x in input().split()]
m = input()
q = [int(x) for x in input().split()]
for i in range(1, len(a)):
	a[i] += a[i - 1]
for x in q:
	print(bisect.bisect_left(a, x) + 1)


def binarySearch(arr, l, r, x):
	if r >= l:
		mid = l + (r - l) // 2
		if arr[mid][0] <= x and arr[mid][1] >= x:
			return mid
		elif arr[mid][0] > x:
			return binarySearch(arr, l, mid - 1, x)
		else:
			return binarySearch(arr, mid + 1, r, x)
	else:
		return -1
piles = int(input())
piles_arr = list(map(int, input().split()))
guesses = int(input())
guess_arr = list(map(int, input().split()))
sum_arr = [(0, piles_arr[0])]
counter = piles_arr[0]
for i in range(1, piles):
	curr = counter
	counter += piles_arr[i]
	sum_arr.append((curr + 1, counter))
for element in guess_arr:
	print(binarySearch(sum_arr, 0, len(sum_arr), element) + 1)


n = int(input())
a = []
r = 0
for k in input().split():
	a += [r] * int(k)
	r += 1
m = int(input())
for x in input().split():
	print(a[int(x) - 1] + 1)


n = int(input())
piles = input().split()
input()
juicy = input().split()
table = []
for i in range(n):
	for _ in range(int(piles[i])):
		table.append(i + 1)
for j in juicy:
	print(table[int(j) - 1])


input()
line = list(map(int, input().split()))
input()
worm = list(map(int, input().split()))
label = [0] * (10 ** 6 + 1)
number = line[0]
count = 1
for i in range(1, sum(line) + 1):
	if i <= number:
		label[i] = count
	else:
		count += 1
		number += line[count - 1]
		label[i] = count
for i in worm:
	print(label[i])


k = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
c = 0
d = []
for i in range(1, len(a) + 1):
	for j in range(a[i - 1]):
		d.append(i)
for i in b:
	print(d[i - 1])


def c(d, t, l, h):
	if l > h:
		print(l + 1)
	else:
		m = int((l + h) / 2)
		if d[m] >= t:
			c(d, t, l, m - 1)
		else:
			c(d, t, m + 1, h)
(a, l1, b, l2) = (int(input()), list(map(int, input().split())), int(input()), list(map(int, input().split())))
l3 = [0] * a
l3[0] = l1[0]
for i in range(1, a):
	l3[i] = l1[i] + l3[i - 1]
for i in l2:
	c(l3, i, 0, a - 1)


from bisect import bisect_left
n = int(input())
worms = list(map(int, input().split()))
m = int(input())
end_indices = [worms[0]]
for j in worms[1:]:
	end_indices.append(end_indices[-1] + j)
succulent_worms = list(map(int, input().split()))
for j in succulent_worms:
	print(bisect_left(end_indices, j) + 1)


import os
import sys
from io import BytesIO, IOBase
input = sys.stdin.readline

def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

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

def main():
	try:
		n = inp()
		a = inlt()
		m = inp()
		b = inlt()
		(temp, presum) = (0, [])
		for i in range(n):
			temp += a[i]
			presum.append(temp)
		(j, temp1) = (0, dict())
		for i in range(1, presum[-1] + 1):
			if i <= presum[j]:
				temp1[i] = j + 1
			else:
				j += 1
				temp1[i] = j + 1
		for i in range(m):
			print(temp1[b[i]])
	except Exception as e:
		print(e)
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')
main()


import math
import bisect

def main():
	n = int(input())
	f = 0
	k = []
	for j in list(map(int, input().split())):
		k.append(j + f)
		f = j + f
	m = int(input())
	for j in list(map(int, input().split())):
		print(bisect.bisect_left(k, j) + 1)
main()


n = int(input())
narr = list(map(int, input().split()))
rnge = [0] * 10000001
(p, i) = (1, 1)
for ii in range(n):
	for j in range(narr[ii]):
		rnge[i] = p
		i += 1
	p += 1
m = int(input())
marr = list(map(int, input().split()))
for i in range(m):
	print(rnge[marr[i]])


from bisect import *
n = int(input())
l = list(map(int, input().split(' ')))
a = [l[0]]
m = int(input())
for i in range(1, n):
	a.append(a[i - 1] + l[i])
o = list(map(int, input().split(' ')))
for i in o:
	print(bisect_left(a, i, 0, n) + 1)


from bisect import bisect_left
n = int(input())
a = list(map(int, input().split()))
q = int(input())
qr = list(map(int, input().split()))
worms = []
s = 0
for i in a:
	s += i
	worms.append(s)
for i in qr:
	print(bisect_left(worms, i) + 1)


n = int(input())
l = []
r = 1
for i in input().rstrip().split():
	l += [r] * int(i)
	r += 1
input()
for j in input().rstrip().split():
	print(l[int(j) - 1])


def search(c, x):
	s = 0
	e = n - 1
	while s <= e:
		h = s + (e - s) // 2
		if c[h] == x:
			return h + 1
		elif x < c[h]:
			e = h - 1
		else:
			s = h + 1
	return e + 2
n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
c = [a[0]]
for i in range(1, n):
	c.append(c[i - 1] + a[i])
for i in range(m):
	print(search(c, b[i]))


ans = list()

def solve():
	n = int(input())
	arr = [int(x) for x in input().split()]
	m = int(input())
	brr = [int(x) for x in input().split()]
	for i in range(n):
		x = int(arr[i])
		for j in range(x):
			ans.append(i + 1)
	for i in range(m):
		x = int(brr[i])
		print(ans[x - 1])
solve()


def search(a, e):
	indx = len(a) // 2
	mn = 0
	mx = len(a) - 1
	while True:
		if mx - mn == 1:
			indx = mn if indx == mx else mx
		if a[indx - 1] < e <= a[indx]:
			return indx
		elif e > a[indx]:
			mn = indx
			indx = (mn + mx) // 2
		else:
			mx = indx
			indx = (mn + mx) // 2
n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
for i in range(1, len(a)):
	a[i] += a[i - 1]
a = [0] + a
for e in q:
	print(search(a, e))


n = int(input())
v = list(map(int, input().split()))
m = int(input())
M = list(map(int, input().split()))
for i in range(1, n):
	v[i] += v[i - 1]

def tap(x):
	global v, n
	(h, t) = (0, n)
	while h <= t:
		mid = (h + t) // 2
		if v[mid] >= x:
			t = mid - 1
		else:
			h = mid + 1
	return t + 2
for i in M:
	print(tap(i))


n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
z = []
for i in range(n):
	for j in range(a[i]):
		z.append(i + 1)
for i in q:
	x = z[i - 1]
	print(x)


from itertools import accumulate

def bs(vals, x):
	(lo, mid, hi) = (0, 0, len(vals) - 1)
	while lo < hi:
		mid = (lo + hi) // 2
		if x == vals[mid]:
			return mid
		elif x > vals[mid]:
			lo = mid + 1
		else:
			hi = mid
	return lo
n = int(input())
worms = list(map(int, input().split()))
m = int(input())
juicy = list(map(int, input().split()))
sums = list(accumulate(worms))
ans = [str(bs(sums, worm) + 1) for worm in juicy]
print('\n'.join(ans))


def f():
	n = int(input())
	A = list(map(int, input().split()))
	m = int(input())
	B = list(map(int, input().split()))
	A_2 = [0] * len(A)
	A_2[0] = A[0]
	for i in range(1, len(A)):
		A_2[i] = A_2[i - 1] + A[i]
	for i in range(len(B)):
		left = -1
		right = len(A) - 1
		while right > left + 1:
			middle = (left + right) // 2
			if A_2[middle] >= B[i]:
				right = middle
			else:
				left = middle
		print(right + 1)
f()


_ = input()
a = [int(s) for s in input().split()]
_ = input()
juice_worms = [int(s) for s in input().split()]

def get_worm_heaps(a, juice_worms):
	heaps = generate_heaps(a)
	juice_worm_heaps = [str(find_heap(heaps, worm)) for worm in juice_worms]
	return juice_worm_heaps

def generate_heaps(a):
	heaps = []
	left_border = 1
	right_border = 0
	for i in range(len(a)):
		right_border += a[i]
		heaps.append((left_border, right_border))
		left_border = right_border + 1
	return heaps

def find_heap(heaps, juice_worm):
	i = 0
	j = len(heaps) - 1
	while i <= j:
		middle = (i + j) // 2
		heap = heaps[middle]
		if heap[0] <= juice_worm <= heap[1]:
			return middle + 1
		elif heap[0] > juice_worm:
			j = middle - 1
		else:
			i = middle + 1
	return -1
print('\n'.join(get_worm_heaps(a, juice_worms)), sep='')


num_piles = int(input())
worm_piles = list(map(int, input().split()))
num_juicy_worms = int(input())
juicy_worm_labels = list(map(int, input().split()))
bins = []
running_sum = 1
for i in range(1, num_piles + 1):
	if i == 1:
		bins.append(running_sum)
		running_sum += worm_piles[i - 1]
	else:
		bins.append(running_sum)
		running_sum += worm_piles[i - 1]
last_bin_idx = num_piles - 1
for juicy_worm_label in juicy_worm_labels:
	if juicy_worm_label >= bins[last_bin_idx]:
		print(last_bin_idx + 1)
		continue
	mn = 0
	mx = last_bin_idx
	while mn <= mx:
		mid_idx = (mn + mx) // 2
		if bins[mid_idx] <= juicy_worm_label < bins[mid_idx + 1]:
			print(mid_idx + 1)
			break
		if juicy_worm_label > bins[mid_idx]:
			mn = mid_idx + 1
		else:
			mx = mid_idx - 1


n = int(input())
l = []
r = 1
for k in input().split():
	for j in range(int(k)):
		l.append(r)
	r += 1
q = input()
for j in input().split():
	print(l[int(j) - 1])


import bisect
int(input())
A = [0]
for i in map(int, input().split()):
	A.append(A[-1] + i)
int(input())
for i in map(int, input().split()):
	print(bisect.bisect_left(A, i))


def bins(a, key, n):
	l = 0
	r = n - 1
	while l <= r:
		mid = (l + r) // 2
		if a[mid] < key:
			l = mid + 1
		else:
			if mid == 0 or a[mid - 1] < key:
				return mid + 1
			r = mid
n = int(input())
a = list(map(int, input().split()))
dp = [a[0]]
for i in range(1, n):
	dp.append(dp[-1] + a[i])
input()
for q in map(int, input().split()):
	print(bins(dp, q, n))


from bisect import bisect_left
x = int(input())
nums = list(map(int, input().split()))
for i in range(1, x):
	nums[i] += nums[i - 1]
y = int(input())
nums2 = list(map(int, input().split()))
for i in range(y):
	res = bisect_left(nums, nums2[i]) + 1
	print(res)


from sys import stdin, stdout

def search(lst, x, end, beg=0):
	mid = (beg + end) // 2
	(a, b) = lst[mid]
	if a <= x and x <= b:
		return mid
	if not beg < end:
		return -1
	if x < a:
		return search(lst, x, mid - 1, beg)
	if x > b:
		return search(lst, x, end, mid + 1)
(lst_a, beg) = ([], 1)
sz = int(stdin.readline())
for a in map(int, stdin.readline().split()):
	lst_a.append((beg, beg + a - 1))
	beg += a
stdin.readline()
for wm in map(int, stdin.readline().split()):
	stdout.write(f'{search(lst_a, wm, sz) + 1}\n')


def bsearch(lis, num):
	n = len(lis)
	first = 0
	last = n - 1
	while first <= last:
		mid = (first + last) // 2
		if lis[mid] <= num <= lis[mid + 1]:
			return mid
		elif lis[mid] > num:
			last = mid - 1
		elif lis[mid + 1] < num:
			first = mid + 1
n = int(input())
nums = list(map(int, input().split()))
sums = []
sums.append(0)
for i in range(0, n):
	sums.append(nums[i] + sums[i])
m = int(input())
quests = list(map(int, input().split()))
for quest in quests:
	ind = bsearch(sums, quest)
	if sums[ind - 1] <= quest <= sums[ind]:
		print(ind)
	else:
		print(ind + 1)


first = input()
n = int(first)
second = input().split()
piles = [int(x) for x in second]
first = input()
m = int(first)
second = input().split()
juicy = [int(x) for x in second]
for i in range(1, n):
	piles[i] = piles[i] + piles[i - 1]
for i in range(m):
	beg = 0
	last = n - 1
	while beg <= last:
		mid = int((beg + last) / 2)
		if juicy[i] > piles[mid]:
			beg = mid + 1
		elif juicy[i] < piles[mid] and mid - 1 >= 0 and (juicy[i] <= piles[mid - 1]):
			last = mid - 1
		else:
			print(mid + 1)
			break


import sys
n = int(sys.stdin.readline())
ind = sys.stdin.readline().strip().split(' ')
m = int(sys.stdin.readline())
q = sys.stdin.readline().strip().split(' ')
ar = []
for i in range(0, n):
	for j in range(0, int(ind[i])):
		ar.append(i)
for i in range(0, m):
	print(ar[int(q[i]) - 1] + 1)


from bisect import bisect
n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
x = []
s = 0
for i in range(n):
	s += a[i]
	x.append(s + 1)
for j in q:
	print(bisect(x, j) + 1)


import itertools as it
int(input())
a = [0]
a.extend(list(it.accumulate(map(int, input().split()))))
int(input())
q = list(map(int, input().split()))
d = {}
for j in range(len(a)):
	for i in range(a[j - 1] + 1, a[j] + 1):
		d[i] = j
for i in range(len(q)):
	q[i] = d[q[i]]
print(*q, sep='\n')


def searchWorm(search, num):
	i = 0
	j = len(search) - 1
	ans = len(search) - 1
	while i < j:
		mid = (i + j) // 2
		if search[mid] >= num:
			j = mid
			ans = min(mid, ans)
		else:
			i = mid + 1
	return ans
n = int(input())
l = list(map(int, input().split()))
q = int(input())
qL = list(map(int, input().split()))
search = [l[0]]
for i in range(1, n):
	search.append(search[i - 1] + l[i])
for i in range(q):
	print(searchWorm(search, qL[i]) + 1)


from bisect import bisect_left
x = int(input())
li = list(map(int, input().split()))
y = int(input())
li1 = list(map(int, input().split()))
for i in range(1, x):
	li[i] += li[i - 1]
for i in li1:
	print(bisect_left(li, i) + 1)


from bisect import bisect_left
n = int(input())
a = list(map(int, input().rstrip().split()))
m = int(input())
q = list(map(int, input().rstrip().split()))
li = [0] * (n + 1)
for i in range(n):
	li[i + 1] = li[i] + a[i]
for x in q:
	print(bisect_left(li, x))


def binary_search(arr, val, left, right):
	if left >= right:
		if val > arr[left]:
			return left + 1
		else:
			return left
	mid = (left + right) // 2
	if val == arr[mid]:
		return mid
	if val < arr[mid]:
		return binary_search(arr, val, left, mid - 1)
	return binary_search(arr, val, mid + 1, right)
n = int(input())
stack = list(map(int, input().split()))
x = int(input())
queries = list(map(int, input().split()))
count = 0
intervals = []
for i in range(n):
	count += stack[i]
	intervals.append(count)
for query in queries:
	print(binary_search(intervals, query, 0, n - 1) + 1)


L = []
input()
r = 1
for k in input().split():
	L += [r] * int(k)
	r += 1
input()
for j in input().split():
	print(L[int(j) - 1])


input()
heaps = list(map(int, input().split()))
input()
numbers = list(map(int, input().split()))
res = [0] * len(numbers)
sums = [heaps[0]]
mask = [1] * heaps[0]
for i in range(1, len(heaps)):
	mask += [i + 1] * heaps[i]
	sums.append(heaps[i] + sums[-1])
for i in range(len(numbers)):
	print(mask[numbers[i] - 1])


def binary_search(a, x):
	ans = 0
	start = 0
	end = len(a) - 1
	while start < end:
		mid = int((start + end) / 2)
		if a[mid] == x:
			return mid + 1
		elif a[mid] > x:
			ans = mid
			end = mid
		elif a[mid] < x:
			ans = mid + 1
			start = mid + 1
	return ans + 1
n = int(input())
a = [int(i) for i in input().split()]
for i in range(1, len(a)):
	a[i] = a[i - 1] + a[i]
m = int(input())
q = [int(i) for i in input().split()]
for i in range(0, len(q)):
	print(binary_search(a, q[i]))


n = int(input())
a = input().split(' ')
m = int(input())
b = input().split(' ')
k = 1
c = {}
for i in range(n):
	c[i + 1] = (k, k + int(a[i]) - 1)
	k = k + int(a[i])
d = []
for j in range(m):
	r = 1
	l = n
	while r <= l:
		mid = l + (r - l) // 2
		if int(b[j]) >= c[mid][0] and int(b[j]) <= c[mid][1]:
			d.append(mid)
			break
		elif int(b[j]) < c[mid][0]:
			l = mid - 1
		else:
			r = mid + 1
for i in d:
	print(i)


n = int(input())
labels = list(map(int, input().split(' ')))
m = int(input())
ans = list(map(int, input().split(' ')))
numbers = [0] * (sum(labels) + 1)
count = 1
i = 1
for x in labels:
	for j in range(i, x + i):
		numbers[j] = count
	count += 1
	i = x + i
for i in ans:
	print(numbers[i])


pile = []
n = input()
a = map(int, input().split())
count = 0
for i in a:
	count += 1
	pile.extend(i * [count])
m = input()
b = map(int, input().split())
for i in b:
	print(pile[i - 1])


from sys import stdin, stdout
inpt = lambda : stdin.readline().strip()
prnt = lambda x: stdout.write(str(x) + '\n')

def find_res(a, q):
	Li = []
	r = 1
	for i in a:
		Li += [r] * i
		r += 1
	for i in q:
		prnt(Li[i - 1])

def main():
	inptf = inpt
	inptf()
	a = map(int, inpt().split())
	inptf()
	q = map(int, inpt().split())
	find_res(a, q)
main()


n = int(input())
L = list(map(int, input().split()))
for i in range(1, n):
	L[i] += L[i - 1]
a = [0] * (L[n - 1] + 1)
for i in L:
	a[i] = 1
for i in range(1, L[n - 1] + 1):
	a[i] += a[i - 1]
for i in range(1, L[n - 1] + 1):
	a[i] += 1
for i in L:
	a[i] -= 1
q = int(input())
Q = list(map(int, input().split()))
for i in range(q):
	print(a[Q[i]])


import sys
input = sys.stdin.readline

def main():
	int(input())
	heaps = list(map(int, input().split()))
	sum = 0
	i = 0
	while i < len(heaps):
		heaps[i] = sum + heaps[i]
		sum = heaps[i]
		i += 1
	int(input())
	es = list(map(int, input().split()))
	for e in es:
		print(binarySearch(heaps, e) + 1)

def binarySearch(arr, n):
	first = 0
	last = len(arr) - 1
	if n > arr[0] and n <= arr[1]:
		return 1
	while first <= last:
		mid = (first + last) // 2
		if mid - 1 < 0:
			return mid
		if n > arr[mid - 1] and n <= arr[mid]:
			return mid
		if arr[mid] > n:
			last = mid - 1
		else:
			first = mid + 1
main()


n = int(input())
x = list(map(int, input().split(' ')))
m = int(input())
y = list(map(int, input().split(' ')))
z = [0] * n
count = 0
for j in range(n):
	count += x[j]
	z[j] = count
for i in range(m):
	l = -1
	r = n - 1
	while l + 1 != r:
		mid = (l + r) // 2
		if y[i] <= z[mid]:
			r = mid
		else:
			l = mid
	print(r + 1)


na = int(input())
a = list(map(int, input().split()))
qa = int(input())
q = list(map(int, input().split()))
beg = 0
end = 0
ans = []
for i in range(na):
	for _ in range(a[i]):
		ans.append(i + 1)
for x in q:
	print(ans[x - 1])


n = int(input())
p = [int(x) for x in input().split()]
m = int(input())
j = [int(x) for x in input().split()]
w = [0] * (10 ** 6 + 1)
s = 1
for i in range(n):
	w[s:s + p[i]] = [i + 1] * p[i]
	s += p[i]
for i in j:
	print(w[i])


bunch_count = int(input())
bounds_input = [int(i) for i in input().split()]
juicy_worms_count = int(input())
juicy_worms_number = [int(i) for i in input().split()]
worms_index = []
bunch_number = 1
for i in bounds_input:
	for j in range(i):
		worms_index.append(bunch_number)
	bunch_number += 1
for worm in juicy_worms_number:
	print(worms_index[worm - 1])


from collections import deque, Counter, OrderedDict
from heapq import nsmallest, nlargest
from math import ceil, floor, log, log2, sqrt, gcd, factorial

def binNumber(n, size=1):
	return bin(n)[2:].zfill(size)

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

def ini():
	return int(input())

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

def sti():
	return str(input())
n = ini()
a = iar()
b = []
s = 0
for i in a:
	b.append(s + i)
	s += i
q = ini()
qs = iar()
for i in qs:
	up = n - 1
	low = 0
	while True:
		mid = (up + low) // 2
		if mid == 0:
			if b[0] >= i:
				print(1)
			elif b[0] < i and b[1] >= i:
				print(2)
			break
		elif b[mid] >= i and b[mid - 1] < i:
			print(mid + 1)
			break
		elif b[mid] < i:
			low = mid + 1
		else:
			up = mid - 1


n = int(input())
(arr, res) = ([], 1)
for i in list(map(int, input().split())):
	arr += [res] * i
	res += 1
m = int(input())
for j in list(map(int, input().split())):
	print(arr[j - 1])


import sys
n = int(input())
a = [int(i) for i in input().split(' ')]
b = []
k = 0
for i in range(n):
	k += 1
	for j in range(a[i]):
		b.append(k)
m = int(input())
a = [int(i) for i in input().split(' ')]
for i in a:
	print(b[i - 1])


n = int(input())
a = [int(x) for x in input().split()]
m = int(input())
q = [int(x) for x in input().split()]
s = 1
W = [0] * (10 ** 6 + 1)
for i in range(n):
	W[s:s + a[i]] = [i + 1] * a[i]
	s += a[i]
for i in q:
	print(W[i])


import bisect
input()
a = list(map(int, input().split()))
(b, s) = ([], 0)
for i in a:
	s += i
	b += [s]
input()
q = list(map(int, input().split()))
for i in q:
	x = bisect.bisect_left(b, i) + 1
	print(x)


from sys import stdin, stdout
import bisect

def st():
	return list(stdin.readline())

def inp():
	return int(stdin.readline())

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

def mp():
	return map(int, stdin.readline().split())
n = inp()
l = li()
m = inp()
k = li()
x = []
c = 0
for i in l:
	x.append(c + i)
	c += i
for i in k:
	a = bisect.bisect_left(x, i) + 1
	print(a)


n = int(input())
a = [int(x) for x in input().split()]
m = int(input())
q = [int(y) for y in input().split()]
l = []
for i in range(n):
	l.append([i + 1] * a[i])
f = []
for sub in l:
	for e in sub:
		f.append(e)
for i in range(m):
	print(f[q[i] - 1])


from bisect import bisect_left
n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
for i in range(1, n):
	a[i] = a[i] + a[i - 1]
for i in range(m):
	pos = bisect_left(a, q[i])
	print(pos + 1)


def search(l, st, en, val):
	if st <= en:
		mid = (st + en) // 2
		if l[mid] <= val and mid == en:
			return mid
		if l[mid] <= val and l[mid + 1] > val:
			return mid
		if val < l[mid]:
			return search(l, st, mid - 1, val)
		else:
			return search(l, mid + 1, len(l) - 1, val)
	else:
		return -1
t = int(input())
l = list(map(int, input().split()))
k = []
prev = l[0]
k.append(l[0])
for i in range(1, t):
	prev += l[i]
	k.append(prev)
q = int(input())
query = list(map(int, input().split()))
for i in range(q):
	n = query[i]
	ind = search(k, 0, len(k) - 1, n)
	if ind == -1:
		if k[ind + 1] == n:
			print(ind + 1)
		else:
			print(ind + 2)
	elif k[ind] == n:
		print(ind + 1)
	else:
		print(ind + 2)


from bisect import *
n = int(input())
l = [*map(int, input().split())]
arr = [l[0]]
for i in range(1, n):
	arr.append(arr[-1] + l[i])
m = int(input())
for i in input().split():
	x = int(i)
	print(bisect_left(arr, x) + 1)


(n, p, m, w) = (int(input()), list(map(int, input().split())), int(input()), sorted(enumerate(map(int, input().split())), key=lambda x: x[1]))
(ans, pos) = ([-1] * m, [0, 0])
for (i, c) in w:
	while pos[0] + p[pos[1]] < c:
		pos[0] += p[pos[1]]
		pos[1] += 1
	ans[i] = pos[1] + 1
print(*ans, sep='\n')


n = int(input())
a = list(map(int, input().split()))
n1 = int(input())
e = list(map(int, input().split()))
b1 = 0
c = []
d = {}
for i in range(len(a)):
	b1 += a[i]
	c.append(b1)
b = sorted(e)
j = 0
for i in range(len(b)):
	if b[i] not in d:
		for k in range(j, len(c)):
			if c[k] >= b[i]:
				d[b[i]] = k + 1
				j = k
				break
for i in range(n1):
	print(d[e[i]])


import sys
input = sys.stdin.readline

def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
n_worms = inp()
worms = inlt()
n_juice = inp()
juicy = inlt()

def createBuckets(worms):
	res = []
	prev_sum = 0
	for i in range(len(worms)):
		worm = worms[i]
		res.append(prev_sum + worm)
		prev_sum += worm
	return res
buckets = createBuckets(worms)

def binarySearch(buckets, juice):
	(i, j) = (0, len(buckets) - 1)
	while i < j:
		m = i + (j - i) // 2
		if buckets[m] >= juice:
			j = m
		else:
			i = m + 1
	return i
for juice in juicy:
	print(binarySearch(buckets, juice) + 1)


from collections import deque
import bisect
n = int(input())
l1 = list(map(int, input().split()))
a = deque()
a.append([1, l1[0]])
b = deque()
b.append(l1[0])
for i in range(1, n):
	x = a[-1][1] + 1
	y = a[-1][1] + l1[i]
	a.append([x, y])
	b.append(y)
b = sorted(b)
m = int(input())
l2 = list(map(int, input().split()))
for i in range(m):
	res = bisect.bisect_left(b, l2[i]) + 1
	print(res)


import bisect
n = int(input())
a = list(map(int, input().split()))
b = [0] * (len(a) + 1)
for i in range(len(a)):
	b[i + 1] = b[i] + a[i]
nq = int(input())
qs = map(int, input().split())
for q in qs:
	print(bisect.bisect_left(b, q))


n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
li = [0]
cur = 1
s = 0
for i in range(1, sum(a) + 1):
	if i > s + a[cur - 1]:
		s += a[cur - 1]
		cur += 1
	li.append(cur)
for i in q:
	print(li[i])


n = int(input())
a = list(input().split())
s = []
s.append(0)
cnt = 1
for i in a:
	y = int(i)
	for j in range(y):
		s.append(cnt)
	cnt += 1
q = int(input())
x = list(input().split())
for i in x:
	print(s[int(i)])


n = int(input())
l = list(map(int, input().split()))
m = int(input())
a = list(map(int, input().split()))
dic = {i: 0 for i in a}
tp = a
a = sorted(a)
for i in range(1, n):
	l[i] += l[i - 1]
(i, j) = (0, 0)
while i < m:
	if a[i] <= l[j]:
		dic[a[i]] = j + 1
		i += 1
		continue
	j += 1
for val in tp:
	print(dic[val])


n = int(input())
alist = [int(x) for x in input().split(' ')]
for i in range(1, n):
	alist[i] += alist[i - 1]
m = int(input())
qlist = [int(x) for x in input().split(' ')]
for i in range(m):
	min0 = 0
	max0 = n - 1
	q = qlist[i]
	if q <= alist[0]:
		print(1)
	else:
		while max0 - min0 > 1:
			mid = (max0 + min0) // 2
			if q < alist[mid]:
				max0 = mid
			elif q == alist[mid]:
				break
			else:
				min0 = mid
		if q == alist[mid]:
			print(mid + 1)
		else:
			print(max0 + 1)


n = int(input())
w = list(map(int, input().split()))
q = int(input())
qarr = list(map(int, input().split()))
a = []
ind = 1
for i in w:
	a += [ind] * i
	ind += 1
for i in qarr:
	print(a[i - 1])


n = int(input())
x = list(map(int, input().split()))
m = int(input())
y = list(map(int, input().split()))
l = [0]
a = 1
for i in x:
	j = i
	while j > 0:
		l.append(a)
		j -= 1
	a += 1
for i in y:
	print(l[i])


from bisect import bisect_left
n = int(input())
s = list(map(int, input().split()))
m = int(input())
p = list(map(int, input().split()))
k = [0] * (n + 1)
for i in range(1, n + 1):
	k[i] = k[i - 1] + s[i - 1]
for i in p:
	print(bisect_left(k, i))


n = int(input())
now = list(map(int, input().split()))
input()
fi = list(map(int, input().split()))
k = [0] * sum(now)
start = 0
m = 1
for i in now:
	k[start:start + i] = [m] * i
	start += i
	m += 1
for i in fi:
	print(k[i - 1])


n = int(input())
l = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
for i in range(1, n):
	l[i] += l[i - 1]
s = l[-1]
j = 0
p = [0]
for i in range(1, s + 1):
	if i > l[j]:
		j += 1
	p.append(j + 1)
for i in range(m):
	print(p[q[i]])


n = int(input())
a = [int(x) for x in input().split()]
grupos = []
ng = 1
for i in a:
	for j in range(i):
		grupos.append(ng)
	ng += 1
m = int(input())
b = [int(x) for x in input().split()]
for j in b:
	print(grupos[j - 1])


L = []
input()
t = 1
for k in input().split():
	L += [t] * int(k)
	t += 1
input()
for j in input().split():
	print(L[int(j) - 1])


n = int(input())
arrn = list(map(int, input().split()))
m = int(input())
arrm = list(map(int, input().split()))
arr = [-1]
for i in range(n):
	for j in range(arrn[i]):
		arr.append(i + 1)
for i in range(m):
	print(arr[arrm[i]])


n = int(input())
a = list(map(int, input().split()))
rng = [[1, a[0]]]
sm = a[0]
for i in range(1, len(a)):
	sm += a[i]
	rng.append([rng[i - 1][1] + 1, sm])
m = int(input())
q = list(map(int, input().split()))
for k in range(m):
	(i, j) = (0, n - 1)
	while i < j:
		if rng[i][0] <= q[k] and q[k] <= rng[i][1]:
			print(i + 1)
			break
		elif rng[j][0] <= q[k] and q[k] <= rng[j][1]:
			print(j + 1)
			break
		else:
			t = (i + j) // 2
			if rng[t][0] <= q[k]:
				i = t
			else:
				j = t


import bisect
n = int(input())
nn = list(map(int, input().rstrip().split()))
m = int(input())
mm = list(map(int, input().rstrip().split()))
summ = 0
for i in range(n):
	summ += nn[i]
	nn[i] = summ
for i in mm:
	print(bisect.bisect_left(nn, i) + 1)


def binary_search(q, a):
	l = 0
	h = len(a)
	while l != h:
		mid = (l + h) // 2
		if a[mid] <= q:
			l = mid + 1
		else:
			h = mid
	return l
n = int(input())
a = list(map(int, input().split()))
m = int(input())
Ql = list(map(int, input().split()))
for i in range(1, len(a)):
	a[i] += a[i - 1]
for i in range(len(a)):
	a[i] += 1
for q in Ql:
	x = binary_search(q, a)
	print(x + 1)


array = [0] * 10 ** 6
n = int(input().rstrip())
noOfWorms = list(map(int, input().rstrip().split()))
m = int(input().rstrip())
queries = list(map(int, input().rstrip().split()))
for i in range(noOfWorms[0]):
	array[i] = 1
index = noOfWorms[0]
for i in range(1, len(noOfWorms)):
	for j in range(index, index + noOfWorms[i]):
		array[j] = i + 1
	index += noOfWorms[i]
for q in queries:
	print(array[q - 1])


n = int(input())
piles = list(map(int, input().split()))[:n]
juicy_number = int(input())
juicy = list(map(int, input().split()))[:juicy_number]
worms = [piles[0]]
j = 0
for i in range(1, len(piles)):
	number_two = worms[j] + piles[i]
	worms.append(number_two)
	j += 1

def binarySearch(arr, l, r, x):
	while l <= r:
		mid = (l + r) // 2
		if arr[mid] == x:
			return mid + 1
		if arr[mid] > x and arr[mid - 1] < x:
			return mid + 1
		if arr[mid] < x and arr[mid + 1] > x:
			return mid + 2
		if arr[mid] > x:
			r = mid - 1
		else:
			l = mid + 1
	return mid + 1
for i in juicy:
	print(binarySearch(worms, 0, len(worms) - 1, i))


n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
worms = {}
prev = 1
for i in range(n):
	for j in range(prev, prev + a[i]):
		worms[j] = i + 1
	prev += a[i]
for x in q:
	print(worms[x])


import bisect
n = int(input())
arr = list(map(int, input().split()))
pile = [0] * n
pile[0] = arr[0]
for i in range(1, n):
	pile[i] = pile[i - 1] + arr[i]
m = int(input())
ls = list(map(int, input().split()))
for i in ls:
	var = bisect.bisect_left(pile, i)
	print(var + 1)


def binary(l, f):
	a = 0
	b = len(l) - 1
	while a <= b:
		m = a + (b - a) // 2
		if l[m] == f:
			return m
		if l[m] < f:
			a = m + 1
		else:
			b = m - 1
	if l[m] < f:
		return m + 1
	return m
n = int(input())
shop_price = list(map(int, input().split(' ')))
count = 1
s = [0]
for i in shop_price:
	for j in range(i):
		s.append(count)
	count += 1
q = int(input())
coins = list(map(int, input().split(' ')))
for i in coins:
	print(s[i])


na = int(input())
a = list(map(int, input().split()))
qa = int(input())
q = list(map(int, input().split()))
beg = 0
end = 0
ans = []

def bsl(beg, end, x, lo):
	global ans
	if beg == end:
		if ans[beg] <= x and ans[beg] > ans[lo]:
			return beg
		return lo
	mid = (beg + end) // 2
	if ans[mid] > x:
		nend = mid - 1 if mid - 1 >= beg else beg
		return bsl(beg, nend, x, lo)
	if ans[mid] <= x:
		lo = mid
		nbeg = mid + 1 if mid + 1 <= end else end
		return bsl(nbeg, end, x, lo)
for i in range(na):
	for _ in range(a[i]):
		ans.append(i + 1)
for x in q:
	print(ans[x - 1])


import bisect
n = int(input())
worms = [int(x) for x in input().split(' ')]
for i in range(n - 1):
	worms[i + 1] += worms[i]
m = int(input())
v = [int(x) for x in input().split(' ')]
[(lambda x: print(bisect.bisect_left(worms, x) + 1))(x) for x in v]


import sys
import bisect
sys.setrecursionlimit(10 ** 5)
readline = sys.stdin.readline

def process():
	n = int(readline())
	(arr, tmp) = ([], 0)
	tmp_list = list(map(int, readline().strip().split()))
	for i in tmp_list:
		tmp += i
		arr.append(tmp)
	m = int(readline())
	tmp_list = list(map(int, readline().strip().split()))
	for target in tmp_list:
		print(bisect.bisect_left(arr, target) + 1)
process()


n = int(input())
piles = [int(a) for a in input().split()]
q = int(input())
queries = [int(b) for b in input().split()]
worms = {}
i = 1
for p in range(n):
	for k in range(piles[p]):
		worms[i] = p + 1
		i += 1
for j in queries:
	print(worms[j])


import bisect
n = int(input())
s = input()
s = s.split()
t = [1]
for i in range(n):
	t.append(t[i] + int(s[i]))
t = sorted(t)
q = int(input())
a = input()
a = a.split()
for i in range(q):
	p = bisect.bisect_left(t, int(a[i]))
	if int(a[i]) == t[p]:
		print(p + 1)
	else:
		print(p)


from itertools import accumulate
n = int(input())
a = list(accumulate((int(i) for i in input().split())))
indices = [None]
j = 0
for i in range(1, a[n - 1] + 1):
	if i > a[j]:
		j += 1
	indices.append(j + 1)
input()
for bi in (int(i) for i in input().split()):
	print(indices[bi])


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
import bisect
from heapq import *
from math import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
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')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
mod = 1000000007

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

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

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

def strsep():
	return map(str, inp().split())

def graph(vertex):
	return [[] for i in range(0, vertex + 1)]

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

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

def power(a, b):
	ans = 1
	while b > 0:
		if b % 2 == 1:
			ans *= a
		a *= a
		b //= 2
	return ans

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def bs(a, l, h, x):
	while l < h:
		mid = (l + h) // 2
		if a[mid] == x:
			return mid
		if a[mid] < x:
			l = mid + 1
		else:
			h = mid
	return l

def sieve(a):
	for i in range(3, 10 ** 6 + 1, 2):
		a[i] = 1
	for i in range(3, 10 ** 6 + 1, 2):
		for j in range(i * i, 10 ** 6 + 1, i):
			a[j] = 0
	a[2] = 1
	return a

def bfs(g, st):
	visited = [0] * len(g)
	visited[st] = 1
	queue = []
	queue.append(st)
	new = []
	while len(queue) != 0:
		s = queue.pop()
		new.append(s)
		for i in g[s]:
			if visited[i] == 0:
				visited[i] = 1
				queue.append(i)
	return new

def solve():
	n = int(inp())
	a = lis()
	m = int(inp())
	b = lis()
	pre = []
	for i in range(0, n):
		if i == 0:
			pre.append(a[i])
			continue
		pre.append(pre[i - 1] + a[i])
	for i in range(0, m):
		print(bs(pre, 0, n - 1, b[i]) + 1)
testcase(1)


n = int(input())
arr = list(map(int, input().split()))
for i in range(1, n):
	arr[i] += arr[i - 1]
q = int(input())
query = list(map(int, input().split()))
d = {}
for i in query:
	d[i] = 0
temp = query[:]
temp.sort()
ans = []
cnt = 0
for i in temp:
	while i > arr[cnt]:
		cnt += 1
	d[i] = cnt + 1
for i in query:
	print(d[i])


from sys import stdin, stdout
from collections import defaultdict
import heapq
import bisect

def get_int():
	return int(stdin.readline().strip())

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

def get_array():
	return list(map(int, stdin.readline().strip().split()))

def get_string():
	return stdin.readline().strip()
INF = 10000000000.0
n = get_int()
a = get_array()
m = get_int()
q = get_array()
for i in range(1, n):
	a[i] += a[i - 1]
for i in range(m):
	print(bisect.bisect_left(a, q[i]) + 1)


def binary_search(list, goal, start, end):
	i = int((start + end) / 2)
	if accum[i] == goal:
		return i + 1
	elif accum[i] < goal:
		return binary_search(list, goal, i, end)
	elif i == 0 or (i > 0 and accum[i - 1] < goal):
		return i + 1
	else:
		return binary_search(list, goal, start, i)
n = int(input())
piles = list(map(int, input().split()))
m = int(input())
worms = list(map(int, input().split()))
accum = []
for elem in piles:
	if len(accum) == 0:
		accum.append(elem)
	else:
		accum.append(elem + accum[-1])
for worm in worms:
	print(binary_search(piles, worm, 0, len(piles)))


n_piles = int(input())
piles = list(map(int, input().split()))
n_juicy = int(input())
juicy = list(map(int, input().split()))
worms = []
for i in range(n_piles):
	pile = [i + 1] * piles[i]
	worms += pile
for j in juicy:
	print(worms[j - 1])


nPiles = input()
nWormPile = input().split(' ')
nJuicyWorm = input()
labelJuicy = input().split(' ')
iWorms = []
idxPile = 0
for i in range(int(nPiles)):
	idxPile += 1
	for j in range(int(nWormPile[i])):
		iWorms.append(idxPile)
for i in range(int(nJuicyWorm)):
	print(iWorms[int(labelJuicy[i]) - 1])


import bisect
n = input()
a = map(int, input().split(' '))
m = input()
q = map(int, input().split(' '))
p = [0]
for ai in a:
	p.append(p[-1] + ai)
for qi in q:
	i = bisect.bisect_left(p, qi)
	print(i)


import bisect
n = int(input())
l = [int(i) for i in input().split()]
m = int(input())
a = [int(i) for i in input().split()]
sum = 0
k = 0
for i in range(n):
	sum += l[i]
	l[i] = sum
for i in range(m):
	x = bisect.bisect_left(l, a[i])
	print(x + 1)


from sys import stdin, stdout
import timeit

class IndexedPile:

	def __init__(self, first, last, index):
		self.first = first
		self.last = last
		self.index = index

	def __repr__(self):
		return '<IndexedPile (%s,%s,%s)' % (self.first, self.last, self.index)

	def is_compared(self, value):
		if value < self.first:
			return -1
		elif value > self.last:
			return 1
		else:
			return 0

def faster_solve(piles_count, piles, juicy_worms_count, juicy_worms):
	solution = []
	pile_dict = {}
	first = 1
	index = 1
	for pile in piles:
		last = first + pile - 1
		for i in range(first, last + 1):
			pile_dict[i] = index
		index += 1
		first = last + 1
	for juicy_worm in juicy_worms:
		solution.append(pile_dict.get(juicy_worm))
	return solution

def solve(piles_count, piles, juicy_worms_count, juicy_worms):
	solution = []
	indexed_piles = []
	first = 1
	index = 1
	for pile in piles:
		last = first + pile - 1
		indexed_pile = IndexedPile(first, last, index)
		indexed_piles.append(indexed_pile)
		index += 1
		first = last + 1
	for juicy_worm in juicy_worms:
		left = 0
		right = len(indexed_piles) - 1
		while left <= right:
			middle = (left + right) // 2
			indexed_pile = indexed_piles[middle]
			comparison = indexed_pile.is_compared(juicy_worm)
			if comparison == 0:
				solution.append(indexed_pile.index)
				break
			elif comparison == 1:
				left = middle + 1
			else:
				right = middle - 1
	return solution
piles_count = int(stdin.readline().rstrip('\r\n'))
piles = [int(x) for x in stdin.readline().rstrip('\r\n').split()]
juicy_worms_count = int(stdin.readline().rstrip('\r\n'))
juicy_worms = [int(x) for x in stdin.readline().rstrip('\r\n').split()]
lst = faster_solve(piles_count, piles, juicy_worms_count, juicy_worms)
for result in lst:
	stdout.write(str(result))
	stdout.write('\n')


n = int(input())
A = list(map(int, input().split()))
m = int(input())
B = list(map(int, input().split()))
for i in range(1, n):
	A[i] = A[i] + A[i - 1]
for i in B:
	l = -1
	r = n - 1
	while l + 1 < r:
		m1 = (l + r) // 2
		if A[m1] >= i:
			r = m1
		else:
			l = m1
	print(r + 1)


n = int(input())
l = list(map(int, input().split()))
q = int(input())
m = list(map(int, input().split()))
a = []
s = sum(l)
prev = l[0]
count = 1
for i in range(s):
	if i < prev:
		a.append(count)
	else:
		count += 1
		prev += l[count - 1]
		a.append(count)
for i in m:
	print(a[i - 1])


from bisect import bisect_left

def binarySearch(array, x):
	temp = bisect_left(array, x)
	try:
		if array[temp] == x:
			return temp + 1
		else:
			return temp
	except:
		return temp
n = input()
listi = list(map(int, input().split()))
sumv = 0
array = []
for i in listi:
	array.append(sumv + 1)
	sumv += i
Q = int(input())
for j in list(map(int, input().split())):
	print(binarySearch(array, j))


n = int(input())
a = list(map(int, input().split()))
for i in range(1, n):
	a[i] += a[i - 1]
k = int(input())
m = list(map(int, input().split()))
for i in range(k):
	l = 0
	r = n - 1
	now = m[i]
	while r > l:
		c = (r + l) // 2
		if a[c] < now:
			l = c + 1
		else:
			r = c
	print(r + 1, end='\n')


n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
d = [0]
for i in range(n):
	d.append(d[i] + a[i])
d.append(1000001)
for i in range(m):
	start = 0
	end = len(d) - 1
	while start < end:
		k = (start + end) // 2
		if q[i] < d[k]:
			end = k - 1
		else:
			start = k + 1
	for t in range(max(0, end - 4), n + 1):
		if q[i] <= d[t]:
			print(t)
			break
	else:
		print(n)


from bisect import bisect_left
isDebug = False
n = int(input())
a = [int(x) for x in input().split()]
m = int(input())
q = [int(x) for x in input().split()]
print(f'a={a}') if isDebug else ''
l = len(a)
for i in range(1, l):
	a[i] = a[i - 1] + a[i]
print(f'a={a}') if isDebug else ''
for x in q:
	print(bisect_left(a, x) + 1)


l = []
input()
c = 1
for k in input().split():
	l += [c] * int(k)
	c += 1
input()
for j in input().split():
	print(l[int(j) - 1])


n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))

def get_worm_pile(number):
	for (pile_number_minus_one, first_worm_number) in enumerate(generated_positions):
		if number < first_worm_number:
			return pile_number_minus_one
	return n
generated_positions = []
count = 1
for i in a:
	generated_positions.append(count)
	count += i
D = {}
counter = 1
pile_number = 1
for pile_size in a:
	for i in range(pile_size):
		D[counter] = pile_number
		counter += 1
	pile_number += 1
for i in q:
	print(D[i])


def binarysearch(a, b):
	l = 0
	h = len(a) - 1
	while l <= h:
		mid = (l + h) // 2
		if a[mid] == b:
			return mid
		elif a[mid] < b:
			l = mid + 1
			continue
		elif a[mid] > b:
			h = mid - 1
			continue
	else:
		return l
t = int(input())
worms = [int(x) for x in input().split()]
m = int(input())
find = [int(s) for s in input().split()]
a = []
sum = 0
for i in worms:
	sum += i
	a.append(sum)
if t == 1:
	for i in range(m):
		print(1)
else:
	for i in find:
		c = binarysearch(a, i)
		print(c + 1)


import sys
f = sys.stdin
n = int(f.readline())
a = map(int, f.readline().split())
flags = list()
for (i, x) in enumerate(a):
	for _ in range(x):
		flags.append(i + 1)
m = int(f.readline())
queries = map(int, f.readline().split())
for q in queries:
	print(flags[q - 1])


N = int(input())
A_arr = list(map(int, input().split()))
M = int(input())
Q_arr = list(map(int, input().split()))
arr2 = []
arr2.append(-1)
sum_cool = sum(A_arr)
curpos = 0
for i in range(N):
	for j in range(A_arr[i]):
		arr2.append(i)
for i in range(M):
	index = Q_arr[i]
	print(arr2[index] + 1)


n = int(input())
l = list(map(int, input().split()))
t = int(input())
m = list(map(int, input().split()))
worm = [l[0]]
for i in range(1, len(l)):
	worm.append(l[i] + worm[i - 1])

def binarySearch(worm, l, r):
	while l <= r:
		mid = l + (r - l) // 2
		if worm[mid] == m[j]:
			return mid + 1
		elif worm[mid] < m[j]:
			l = mid + 1
			if worm[mid + 1] > m[j]:
				return mid + 2
		else:
			r = mid - 1
			if worm[mid - 1] < m[j]:
				return mid + 1
	return -1
for j in range(t):
	if m[j] < worm[0]:
		print(1)
	else:
		l = 0
		r = n - 1
		result = binarySearch(worm, l, r)
		print(result)


import bisect
n = int(input())
a = [int(x) for x in input().split()]
m = int(input())
b = [int(x) for x in input().split()]
c = [a[0]]
for i in range(n - 1):
	c.append(c[i] + a[i + 1])
for i in range(m):
	print(bisect.bisect_left(c, b[i], 0, n) + 1)


a = int(input())
lista = list(map(int, input().split()))
b = int(input())
lista2 = list(map(int, input().split()))
worms = [0]
i = 1
for amt in lista:
	worms += [i] * amt
	i += 1
for worm in lista2:
	print(worms[worm])


n = int(input())
ai = input().split()
m = int(input())
qi = input().split()
ai[0] = int(ai[0])
for i in range(1, n):
	ai[i] = int(ai[i]) + ai[i - 1]
for i in range(m):
	qi[i] = int(qi[i])
	left = 0
	right = n
	while right > left:
		mid = (right + left) // 2
		if qi[i] < ai[mid]:
			right = mid
		elif qi[i] > ai[mid]:
			left = mid + 1
		else:
			print(mid + 1)
			break
	else:
		if qi[i] < ai[left]:
			print(left + 1)
		else:
			print(right + 1)


a = int(input())
b = list(map(int, input().split()))
c = int(input())
d = list(map(int, input().split()))
for k in range(1, a):
	b[k] += b[k - 1]
for j in d:
	l = 0
	r = a - 1
	while l <= r:
		if j <= b[0]:
			mid = 0
			break
		mid = (l + r) // 2
		if b[mid] >= j and b[mid - 1] < j:
			break
		elif b[mid] > j:
			r = mid - 1
		else:
			l = mid + 1
	print(mid + 1)


n = int(input())
a = [int(i) for i in input().split()]
m = int(input())
c = 0
q = [int(i) for i in input().split()]
for i in range(0, n):
	a[i] = a[i] + c
	c = a[i]
for i in range(0, m):
	l = 0
	u = n - 1
	while u - l > 0:
		mid = int((l + u) / 2)
		if q[i] > a[mid - 1] and q[i] <= a[mid]:
			print(mid + 1)
			break
		elif q[i] > a[mid]:
			l = mid + 1
		else:
			u = mid - 1
	if u - l < 1:
		print(l + 1)


n = int(input())
a = [int(x) for x in input().split()]
m = int(input())
q = [int(x) for x in input().split()]
worm = []
for x in range(n):
	for y in range(a[x]):
		worm.append(x + 1)
for x in range(m):
	print(worm[q[x] - 1])


n = int(input())
list1 = list(map(int, input().split(' ')))
list2 = []
cou = 1
for i in list1:
	for k in range(i):
		list2.append(cou)
	cou += 1
k = int(input())
list3 = list(map(int, input().split(' ')))
for i in range(k):
	print(list2[list3[i] - 1])


n = int(input())
b = []
b.append(0)
l_n = list(map(int, input().split()))
for i in range(len(l_n)):
	for _ in range(l_n[i]):
		b.append(i + 1)
_ = input()
for v in list(map(int, input().split())):
	print(b[v])


(n, a) = (int(input()), list(map(int, input().split())))
(m, q) = (int(input()), list(map(int, input().split())))
dp = []
for i in range(n):
	dp += [i + 1] * a[i]
for x in q:
	print(dp[x - 1])


from bisect import bisect_left as bl
n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
asu = []
asu.append(a[0])
for i in range(1, n):
	asu.append(asu[-1] + a[i])
for i in range(m):
	print(bl(asu, q[i]) + 1)


from bisect import bisect as bs
n = int(input())
l = list(map(int, input().split()))
a = [0] * n
m = 0
for i in range(n):
	m += l[i]
	a[i] = m
q = int(input())
s = set(a)
query = list(map(int, input().split()))
for i in range(q):
	print(bs(a, query[i]) + (1 if query[i] not in s else 0))


n = int(input())
a = input().split()
a = list((int(it) for it in a))
m = int(input())
q = input().split()
q = list((int(it) for it in q))
sum1 = 0
ans = 0
d = []
for j in range(n):
	sum1 += a[j]
	d.append(sum1)

def find(a, target):
	st = 0
	end = len(a) - 1
	while st <= end:
		mid = (st + end) // 2
		if a[mid] <= target:
			st = mid + 1
		else:
			end = mid - 1
	return st
for i in range(m):
	p = find(d, q[i])
	if d[p - 1] == q[i]:
		print(p)
	else:
		print(p + 1)


li = []
m = int(input())
a = 1
for i in input().split():
	li += [a] * int(i)
	a += 1
n = int(input())
for j in input().split():
	print(li[int(j) - 1])


n = int(input())
a = list(map(int, input().split()))
input()
queries = list(map(int, input().split()))
ans = []
for i in range(n):
	ans += [i] * a[i]
for q in queries:
	print(ans[q - 1] + 1)


l = []
input()
r = 1
for k in input().split():
	l += [r] * int(k)
	r += 1
input()
for j in input().split():
	print(l[int(j) - 1])


n = int(input())
l = [int(x) for x in input().split()]
m = input()
s = [int(x) for x in input().split()]
lk = [0] * sum(l)
a = 0
for i in range(n):
	for j in range(l[i]):
		lk[a + j] = i + 1
	a += l[i]
for i in s:
	print(lk[i - 1])


import sys
import os
import math
import copy
from math import gcd
from bisect import bisect
from io import BytesIO, IOBase
from math import sqrt, floor, factorial, gcd, log, ceil
from collections import deque, Counter, defaultdict
from itertools import permutations, combinations
import itertools

def Int():
	return int(sys.stdin.readline())

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

def Lstr():
	return list(sys.stdin.readline().strip())

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

def Mstr():
	return map(str, sys.stdin.readline().strip().split())

def List():
	return list(map(int, sys.stdin.readline().split()))

def Hash():
	return dict()

def Mod():
	return 1000000007

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

def Most_frequent(list):
	return max(set(list), key=list.count)

def Mat2x2(n):
	return [List() for _ in range(n)]

def Lcm(x, y):
	return x * y // gcd(x, y)

def dtob(n):
	return bin(n).replace('0b', '')

def btod(n):
	return int(n, 2)

def binary(s, e, x, q):
	while s <= e:
		mid = (s + e) // 2
		if x[mid] < q:
			s = mid + 1
		elif x[mid] > q:
			e = mid - 1
		else:
			return mid
	return s

def solution():
	n = Int()
	a = List()
	m = Int()
	q = List()
	x = list(itertools.accumulate(a))
	for i in range(m):
		print(binary(0, len(x) - 1, x, q[i]) + 1)
solution()


n = int(input())
a = [int(i) for i in input().split()[:n]]
m = int(input())
q = [int(j) for j in input().split()[:m]]
v = [] * n
w = []
z1 = []
x1 = 0
x2 = 0
for k in range(n):
	s1 = 1 + x1
	s2 = a[k] + x2
	x1 = s2
	x2 = x2 + a[k]
	v.append([s1, s2])
	z1.append(s1)

def binary_search(arr, x):
	low = 0
	high = len(arr) - 1
	mid = 0
	while low <= high:
		mid = (high + low) // 2
		if arr[mid] < x:
			low = mid + 1
		elif arr[mid] > x:
			high = mid - 1
		else:
			return mid
	return high
for d in range(m):
	res = binary_search(z1, q[d])
	print(res + 1)


input()
ls = list(map(int, input().split()))
bar = []
lab = 1
for size in ls:
	bar += [lab] * size
	lab += 1
input()
qs = map(int, input().split())
for q in qs:
	print(bar[q - 1])


n = int(input())
l = [int(i) for i in input().split()]
psum = [0] * n
psum[0] = l[0]
for i in range(1, n):
	psum[i] = psum[i - 1] + l[i]
from bisect import bisect_left
q = int(input())
qarry = [int(i) for i in input().split()]
for i in qarry:
	print(bisect_left(psum, i) + 1)


import sys
import math
import bisect

def main():
	n = int(input())
	A = list(map(int, input().split()))
	for i in range(1, n):
		A[i] += A[i - 1]
	q = int(input())
	B = list(map(int, input().split()))
	for b in B:
		p = bisect.bisect_left(A, b)
		print(p + 1)
main()


n = int(input())
s = input().split()
m = int(input())
p = input().split()
l = []
c = 0
for i in range(n):
	j = 0
	while j < int(s[i]):
		l.append(i)
		j += 1
for i in range(m):
	print(l[int(p[i]) - 1] + 1)


n = int(input())
list1 = list(map(int, input().split()))
m = int(input())
list2 = list(map(int, input().split()))

def find(data, k):
	(i, j) = (0, len(data))
	while i < j:
		m = (i + j) // 2
		if data[m] >= k:
			j = m
		else:
			i = m + 1
	return i + 1
nums = 0
bookList = []
for i in list1:
	nums += i
	bookList.append(nums)
for i in list2:
	print(find(bookList, i))


n = int(input())
l1 = list(map(int, input().split()))
m = int(input())
l2 = list(map(int, input().split()))
l3 = [l1[0]]
for i in range(1, n):
	l3.append(l3[i - 1] + l1[i])

def bin_search(l3, n, e):
	(l, r) = (0, n - 1)
	last = n
	while l <= r:
		mid = (l + r) // 2
		if l3[mid] > e:
			r = mid - 1
			if mid < last:
				last = mid
		else:
			l = mid + 1
	if l3[last - 1] == e:
		return last
	return last + 1
for e in l2:
	print(bin_search(l3, n, e))


import bisect
n = int(input())
na = list(map(int, input().split()))
q = int(input())
b = list(map(int, input().split()))
a = []
sm = 0
for i in range(len(na)):
	sm = sm + na[i]
	a.append(sm)
for i in b:
	ans = bisect.bisect_left(a, i)
	print(ans + 1)


a = int(input())
heap = [int(x) for x in input().split()]
b = int(input())
sochnyi = [int(x) for x in input().split()]
arr = []
for i in range(len(heap)):
	for j in range(heap[i]):
		arr.append(i)
for i in sochnyi:
	print(arr[i - 1] + 1)


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from collections import Counter
inp = lambda : int(input())
strng = lambda : input().strip()
jn = lambda x, l: x.join(map(str, l))
strl = lambda : list(input().strip())
mul = lambda : map(int, input().strip().split())
mulf = lambda : map(float, input().strip().split())
seq = lambda : list(map(int, input().strip().split()))
ceil = lambda x: int(x) if x == int(x) else int(x) + 1
ceildiv = lambda x, d: x // d if x % d == 0 else x // d + 1
flush = lambda : stdout.flush()
stdstr = lambda : stdin.readline()
stdint = lambda : int(stdin.readline())
stdpr = lambda x: stdout.write(str(x))
stdarr = lambda : map(int, stdstr().split())
mod = 1000000007
d = {}
n = stdint()
arr = seq()
m = stdint()
q = seq()
k = 1
for i in range(n):
	for j in range(arr[i]):
		d[k] = i + 1
		k = k + 1
for i in range(m):
	print(d[q[i]])


(a, b, c, d, e) = (input(), list(map(int, input().split())), input(), list(map(int, input().split())), [])
for i in range(len(b)):
	for j in range(b[i]):
		e.append(i + 1)
for i in d:
	print(e[i - 1])


def bs(k):
	global n
	l = 0
	r = n + 1
	while l <= r:
		mid = (l + r) // 2
		if k >= pref[mid] + 1 and k <= pref[mid + 1]:
			return mid
		if k <= pref[mid]:
			r = mid
		else:
			l = mid + 1
n = int(input())
arr = list(map(int, input().split()))
pref = [0] * (n + 1)
for i in range(1, n + 1):
	pref[i] = pref[i - 1] + arr[i - 1]
q = int(input())
for k in list(map(int, input().split())):
	print(bs(k) + 1)


n = int(input())
w = list(map(int, input().split()))
l = []
m = int(input())
j = list(map(int, input().split()))
r = []
for k in range(1, n + 1):
	l += [k] * w[k - 1]
for i in j:
	print(l[i - 1])


n = int(input())
l = list(map(int, input().split()))
k = [0]
for i in range(n):
	k += [k[-1] + l[i]]
m = int(input())
l = list(map(int, input().split()))
ans = []
for x in l:
	(l, r, a) = (0, n, n)
	while l <= r:
		m = (l + r) // 2
		if x <= k[m]:
			a = m
			r = m - 1
		else:
			l = m + 1
	ans += [str(a)]
print('\n'.join(ans))


list = []
input()
i = 1
for k in input().split():
	list += [i] * int(k)
	i += 1
input()
for j in input().split():
	print(list[int(j) - 1])


def binarry_search_interval(array, num):
	i = 0
	j = len(array)
	while i <= j:
		mid = (i + j) // 2
		if array[mid] == num:
			return mid + 1
		if array[mid] > num:
			j = mid - 1
		else:
			i = mid + 1
	return i + 1

def solution():
	n = int(input())
	worms = list(map(int, input().split()))
	m = int(input())
	moles = list(map(int, input().split()))
	for i in range(1, n):
		worms[i] = worms[i - 1] + worms[i]
	for j in range(m):
		print(binarry_search_interval(worms, moles[j]))
solution()


n_piles = int(input())
s_piles = input().split(' ')
piles = []
for i in range(n_piles):
	pile = [i + 1] * int(s_piles[i])
	piles.extend(pile)
n_search = int(input())
s_search = input().split(' ')
for i in range(n_search):
	print(piles[int(s_search[i]) - 1])


def worms_find(find):
	left = -1
	right = len(piles_p)
	while left + 1 < right:
		mid = left + (right - left) // 2
		if piles_p[mid] == find:
			right = mid
			break
		elif piles_p[mid] > find:
			right = mid
		else:
			left = mid
	return right + 1
input()
piles = list(map(int, input().split()))
piles_p = []
temp = 0
for i in piles:
	temp += i
	piles_p.append(temp)
input()
worms = list(map(int, input().split()))
for j in range(len(worms)):
	print(worms_find(worms[j]))


from bisect import bisect_left
n = int(input())
ls = list(map(int, input().split()))
m = int(input())
vals = list(map(int, input().split()))
nls = [ls[0]]
for i in range(1, n):
	nls.append(nls[i - 1] + ls[i])
for val in vals:
	ind = bisect_left(nls, val)
	print(ind + 1)


mod = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
from bisect import *
n = ii()
l = il()
m = ii()
lq = il()
lsf = [l[0]]
for i in range(1, n):
	lsf.append(lsf[-1] + l[i])
for i in lq:
	print(bisect_left(lsf, i) + 1)


def main():
	n = int(input())
	a = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	acc_a = [0] * n
	acc = 0
	for (i, x) in enumerate(a):
		acc = acc_a[i] = x + acc
	for x in q:
		(low, high) = (0, n - 1)
		while low < high:
			mid = low + high >> 1
			if x <= acc_a[mid]:
				high = mid
			else:
				low = mid + 1
		print(low + 1)
main()


def binary_search(arr, low, high, target):
	while low < high:
		mid = low + int((high - low) / 2)
		if arr[mid] >= target:
			high = mid
		else:
			low = mid + 1
	return low + 1

def main():
	n = int(input())
	arr = [int(x) for x in input().split()]
	m = int(input())
	qrr = [int(x) for x in input().split()]
	frr = []
	count = 0
	for i in arr:
		count += i
		frr.append(count)
	for q in qrr:
		print(binary_search(frr, 0, len(arr) - 1, q))
main()


n = int(input())
a = list(map(int, input().split()))
m = int(input())
l = list(map(int, input().split()))
v = []
r = 0
for i in range(n):
	v.append(a[i] + r)
	r += a[i]

def bins(v, t):
	start = 0
	end = len(v) - 1
	i = 0
	index = 0
	while start <= end:
		mid = (start + end) // 2
		if t <= v[0]:
			return 1
		elif v[mid] >= t and v[mid - 1] < t:
			return mid + 1
			index = mid + 1
		elif v[mid] < t:
			start = mid + 1
		else:
			end = mid - 1
for i in l:
	print(bins(v, i))


n = int(input())
s = 0
prev_s = 0
m = []
pile_num = 1
for x in input().split():
	s += int(x)
	for i in range(prev_s, s):
		m.append(pile_num)
	prev_s = s
	pile_num += 1
q = int(input())
for x in input().split():
	print(m[int(x) - 1])


n = int(input())
a = list(map(int, input().split()))
for i in range(1, n):
	a[i] = a[i] + a[i - 1]
c = (a[n - 1] + 1) * [0]
c[0] = 1
for i in range(n):
	c[a[i]] = 1
for i in range(1, len(c)):
	c[i] = c[i] + c[i - 1]
m = int(input())
w = list(map(int, input().split()))
for i in w:
	print(c[i - 1])


get_int = lambda : map(int, input().split())
heaps_quantity = get_int()
heap_capacity = get_int()
worms_quantity = get_int()
worm_number = get_int()
a = 0
cnt = 0
h = []
for i in heap_capacity:
	a += i
	cnt += 1
	for j in range(a - i, a):
		h.append(cnt)
for i in worm_number:
	print(h[i - 1])


n = int(input())
li = []
k = 1
for i in input().split():
	x = [k] * int(i)
	k += 1
	li.extend(x)
m = int(input())
for i in input().split():
	print(li[int(i) - 1])


numPiles = int(input())
arrPiles = input().strip().split()
numWorms = int(input())
arrWorms = input().strip().split()
arrPiles[0] = int(arrPiles[0])
for i in range(1, len(arrPiles)):
	arrPiles[i] = int(arrPiles[i])
	arrPiles[i] += arrPiles[i - 1]
arr2 = []
for i in range(len(arrWorms)):
	arr2.append([int(arrWorms[i]), i])
arr2.sort(key=lambda x: x[0])
i = 0
j = 0
while i < numWorms:
	while i < numWorms and arr2[i][0] <= arrPiles[j]:
		arr2[i][0] = j + 1
		i += 1
	j += 1
arr2.sort(key=lambda x: x[1])
for i in range(len(arrWorms)):
	print(str(arr2[i][0]))


def find_pile(m, l):
	b = 0
	e = len(l) - 1
	r = -1
	while b <= e:
		mid = b + (e - b) // 2
		if m <= l[mid]:
			r = mid
			e = mid - 1
		else:
			b = mid + 1
	return r
n = int(input())
a = list(map(int, input().split()))
for i in range(1, n):
	a[i] += a[i - 1]
m = int(input())
for x in list(map(int, input().split())):
	print(1 + find_pile(x, a))


n = int(input())
a = list(map(int, input().split()))
cnt = [0] * 1000001
s = 1
for i in range(n):
	for j in range(a[i]):
		cnt[s + j] = i + 1
	s += a[i]
m = int(input())
b = list(map(int, input().split()))
for i in range(m):
	print(cnt[b[i]])


n = int(input())
w = list(map(int, input().split()))
input()
q = list(map(int, input().split()))
b = []
for i in range(n):
	b += [i + 1] * w[i]
for i in q:
	print(b[i - 1])


from sys import stdin, stdout

def binary_search(array, target):
	l = 0
	r = len(array) - 1
	while l < r:
		mid = (l + r) // 2
		if array[mid] < target:
			l = mid + 1
		elif array[mid] > target:
			r = mid
		else:
			return mid
	return r

def main():
	n = int(stdin.readline())
	heaps = [int(x) for x in stdin.readline().split()]
	prefixsum = []
	t = 0
	ans = []
	for i in range(n):
		t += heaps[i]
		prefixsum.append(t)
	k = int(stdin.readline())
	need = [int(x) for x in stdin.readline().split()]
	for i in range(len(need)):
		z = binary_search(prefixsum, need[i])
		ans.append(z + 1)
	for i in range(len(need)):
		print(ans[i])
main()


kheap = int(input())
heaps = list(map(int, input().split()))
kworms = int(input())
worms = list(map(int, input().split()))
d1 = {i: 0 for i in range(1, sum(heaps) + 1)}
prev = 0
counter = 1
for i in heaps:
	start = prev + 1
	prev += i
	for i2 in range(start, prev + 1):
		d1[i2] = counter
	counter += 1
for num in worms:
	print(d1[num])


import bisect
n = int(input())
l1 = list(map(int, input().split()))
for i in range(1, len(l1)):
	l1[i] = l1[i] + l1[i - 1]
m = int(input())
l2 = list(map(int, input().split()))
for i in l2:
	print(bisect.bisect_left(l1, i) + 1)


n = int(input())
a = list(map(int, input().split()))
c = []
s = 0
for x in a:
	s += x
	c.append(s)
m = int(input())
q = list(map(int, input().split()))
for x in q:
	l = 1
	r = n
	while l < r - 1:
		m = (l + r) // 2
		if c[m - 1] < x:
			l = m
		else:
			r = m
	if c[l - 1] >= x:
		print(l)
	else:
		print(r)


n = int(input())

def binarySearch(x, arr, start, end):
	if start >= end:
		return end
	mid = start + (end - start) // 2
	if arr[mid] == x:
		return mid
	elif arr[mid] < x:
		return binarySearch(x, arr, mid + 1, end)
	elif arr[mid] > x:
		return binarySearch(x, arr, start, mid)
t = list(map(int, input().split()))
csum = [t[0]]
for i in range(1, n):
	csum.append(t[i] + csum[i - 1])
a = int(input())
j = list(map(int, input().split()))
for i in range(a):
	print(binarySearch(j[i], csum, 0, n) + 1)


n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
t = [0]
for (idx, val) in enumerate(a):
	for j in range(val):
		t.append(idx + 1)
for val in q:
	print(t[val])


n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
c = []
s = 1
for i in range(n):
	c += [s] * a[i]
	s += 1
for i in range(m):
	print(c[b[i] - 1])


n = int(input())
arr = list(map(int, input().split()[:n]))
for i in range(1, n):
	arr[i] += arr[i - 1]

def b_search(start, end, a):
	if start > end:
		return (start + end + 1) // 2
	mid = (start + end) // 2
	if arr[mid] == a:
		return mid
	elif arr[mid] > a:
		return b_search(start, mid - 1, a)
	else:
		return b_search(mid + 1, end, a)
m = int(input())
brr = list(map(int, input().split()[:m]))
for i in range(m):
	ind = b_search(0, n, brr[i])
	ind += 1
	print(ind)


from sys import stdin, stdout
input = stdin.readline
n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
srt = sorted(zip(q, list(range(m))))
rng = [0] * m
cnt = 0
for (i, j) in srt:
	q[cnt] = i
	rng[cnt] = j
	cnt += 1
r = 0
j = 0
res = [''] * m
for i in range(n):
	while r < q[j] <= a[i]:
		res[rng[j]] = str(i + 1)
		j += 1
		if j == m:
			stdout.write('\n'.join(res))
			exit(0)
	if i < n - 1:
		a[i + 1] += a[i]


import sys

def solve():
	(n,) = read()
	mem = read()
	count = sum(mem)
	mem2 = [0] * count
	index = 0
	for i in range(n):
		temp = mem[i]
		for j in range(temp):
			mem2[index] = i
			index += 1
	(m,) = read()
	second = read()
	for i in range(m):
		temp = second[i]
		print(mem2[temp - 1] + 1)

def read(mode=2):
	inputs = input().strip()
	if mode == 0:
		return inputs
	if mode == 1:
		return inputs.split()
	if mode == 2:
		return list(map(int, inputs.split()))

def write(s='\n'):
	if s is None:
		s = ''
	if isinstance(s, list):
		s = ' '.join(map(str, s))
	if isinstance(s, tuple):
		s = ' '.join(map(str, s))
	s = str(s)
	print(s, end='')

def run():
	if sys.hexversion == 50594544:
		sys.stdin = open('test.txt')
	res = solve()
	write(res)
run()


input()
array = []
c = 1
for item in input().split():
	array += [c] * int(item)
	c += 1
input()
for item in input().split():
	print(array[int(item) - 1])


import math
from bisect import bisect_left, bisect_right

def solve(m):
	l = 0
	r = n - 1
	ans = -1
	while l <= r:
		mid = l + (r - l) // 2
		if pre[mid] >= m:
			ans = mid
			r = mid - 1
		else:
			l = mid + 1
	print(ans + 1)
n = int(input())
a = list(map(int, input().split()))
q = int(input())
pre = [0] * n
pre[0] = a[0]
for i in range(1, n):
	pre[i] = pre[i - 1] + a[i]
queries = list(map(int, input().split()))
for i in queries:
	solve(i)


from bisect import *
from itertools import *
(i, x) = (input, lambda : [int(x) for x in i().split()])
(_, a, _) = (i(), list(accumulate(x())), i())
for i in x():
	print(bisect_left(a, i) + 1)


def fst(tuple):
	return tuple[0]

def snd(tuple):
	return tuple[1]
n = input()
piles = list(map(int, input().split()))
w = input()
worms = list(map(int, input().split()))
piles[0] = (1, piles[0])
ans = [0 for i in range(10 ** 6 + 2)]
for i in range(len(piles)):
	if i > 0:
		size = piles[i]
		piles[i] = (snd(piles[i - 1]) + 1, snd(piles[i - 1]) + size)
	for j in range(fst(piles[i]), snd(piles[i]) + 1):
		ans[j] = i + 1
for w in worms:
	print(ans[w])


def main():
	n = int(input())
	s = input().split()
	piles = []
	total = 0
	for i in range(n):
		piles += [i + 1] * int(s[i])
	m = int(input())
	juicy = input().split()
	for i in range(m):
		index = int(juicy[i]) - 1
		print(piles[index])
main()


from bisect import bisect_left
n = input()
b = list(map(int, input().split()))
for i in range(1, len(b)):
	b[i] += b[i - 1]
m = int(input())
t = list(map(int, input().split()))
for i in t:
	a = bisect_left(b, i)
	if a == len(b):
		print(n)
	else:
		print(a + 1)


n = int(input())
temp = input()
temp = temp.split(' ')
m = int(input())
t1 = input()
t1 = t1.split(' ')
a = list(map(int, t1))
b = a.copy()
a.sort()
dic = {}
i = 0
start = 1
search = a[i]
sum = 0
count = 1
for x in temp:
	sum += int(x)
	if start <= search <= sum:
		while start <= search <= sum:
			dic[search] = count
			i += 1
			if i >= m:
				break
			search = a[i]
	if i >= m:
		break
	start = sum + 1
	count += 1
for x in b:
	print(dic[int(x)])


fn = input

def get_closest_binary(num, l):
	if num > l[-1]:
		return l[-1]
	elif num < l[0]:
		return 0
	else:
		m = 0
		ma = len(l) - 1
		while ma - m > 1:
			if num > l[m + (ma - m) // 2]:
				m += (ma - m) // 2
			else:
				ma -= (ma - m) // 2 + 1
		if num > l[ma]:
			return ma
		else:
			return m
n = int(fn())
p = list(map(int, fn().rstrip().split(' ')))
t = int(fn())
a = list(map(int, fn().rstrip().split(' ')))
l = [0] * (n + 1)
for i in range(1, n + 1):
	l[i] = l[i - 1] + p[i - 1]
for j in a:
	print(get_closest_binary(j, l) + 1)


nPilhasVermes = int(input())
nVermesPorPilha = input().split()
nVermesSaborosos = int(input())
iVermeSaboroso = input().split()
lista = []
for i in range(nPilhasVermes):
	for j in range(int(nVermesPorPilha[i])):
		lista.append(i + 1)
for i in range(nVermesSaborosos):
	print(lista[int(iVermeSaboroso[i]) - 1])


input()
W = []
for (i, v) in enumerate(list(map(int, input().split()))):
	W += [i + 1] * v
input()
for v in list(map(int, input().split())):
	print(W[v - 1])


n = int(input())
list1 = list(map(int, input().split()))
m = int(input())
list2 = list(map(int, input().split()))
w = [0] * 100002
s = 1
for i in range(n):
	w[s:s + list1[i]] = [i + 1] * list1[i]
	s += list1[i]
for k in range(m):
	print(w[list2[k]])


def bin_search(li, k, l, h):
	m = (l + h) // 2
	if k == li[m]:
		return m + 1
	elif li[m - 1] < k < li[m] and m != 0:
		return m + 1
	elif k < li[m] and m == 0:
		return m + 1
	elif k > li[m] and m == len(li) - 1:
		return m + 1
	elif k > li[m]:
		return bin_search(li, k, m + 1, h)
	else:
		return bin_search(li, k, l, m - 1)
n = int(input())
worm_piles = list(map(int, input().split()))
for i in range(1, n):
	worm_piles[i] += worm_piles[i - 1]
m = int(input())
for i in input().split():
	t = int(i)
	print(bin_search(worm_piles, t, 0, n - 1))


n = int(input())
nums = [0] + [int(x) for x in input().split()]
m = int(input())
labs = [int(x) for x in input().split()]
index = [0] * (n + 1)
t = 1
for i in range(1, len(nums)):
	index[t:t + nums[i]] = [i] * nums[i]
	t += nums[i]
for i in labs:
	print(index[i])


from itertools import accumulate

def bs(ws, w):
	(i, e) = (-1, len(ws) - 1)
	while e - i > 1:
		m = (e + i) // 2
		if w <= ws[m]:
			e = m
		else:
			i = m
	return e
input()
worms = list(accumulate(map(int, input().split())))
input()
tofind = list(map(int, input().split()))
print('\n'.join((str(bs(worms, w) + 1) for w in tofind)))


def binsearch(prefix, ele, n):
	(l, r) = (0, n)
	while l <= r:
		mid = l + (r - l) // 2
		if ele <= prefix[mid] and ele > prefix[mid - 1]:
			return mid
		elif ele > prefix[mid]:
			l = mid + 1
		else:
			r = mid - 1
	return -1
n = int(input())
a = list(map(int, input().split()))
m = int(input())
j = list(map(int, input().split()))
prefix = [0]
for i in range(n):
	prefix.append(a[i] + prefix[i])
for i in j:
	print(binsearch(prefix, i, n + 1))


from bisect import bisect_left
from itertools import accumulate
n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
sums = list(accumulate(a))
ans = list()
for num in q:
	ans.append(bisect_left(sums, num) + 1)
print('\n'.join(map(str, ans)))


entrada = int(input())
gusanos = list(map(int, input().strip().split(' ')))
jugosos = int(input())
gusanos_jugosos = list(map(int, input().strip().split(' ')))

def Busqueda_binaria(x, l, g):
	lista = [0] * x
	cont = 0
	for (i, j) in enumerate(l):
		cont = lista[i] = j + cont
	for k in g:
		izq = 0
		der = x - 1
		while izq < der:
			medio = izq + der >> 1
			if k <= lista[medio]:
				der = medio
			else:
				izq = medio + 1
		print(izq + 1)
Busqueda_binaria(entrada, gusanos, gusanos_jugosos)


n = int(input())
a = list(map(int, input().split()))
sum = 0
d = {}
c = 0
k = 0
for i in a:
	c += 1
	for j in range(i):
		k += 1
		d[k] = c
input()
c = list(map(int, input().split()))
for i in c:
	print(d[i])


import math

def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return (n, b)

def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return (n, b, c)

def dv():
	(n, m) = map(int, input().split())
	return (n, m)

def dva():
	(n, m) = map(int, input().split())
	b = [int(x) for x in input().split()]
	return (n, m, b)

def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return (n, b, m, c)

def dvs():
	n = int(input())
	m = int(input())
	return (n, m)
(n, a) = na()
(m, b) = na()
isk = []
for i in range(n):
	sc = a[i]
	dop = [i + 1] * sc
	isk += dop
for i in b:
	print(isk[i - 1])


n = int(input())
a = [int(i) for i in input().split()]
m = int(input())
q = [int(i) for i in input().split()]
b = q.copy()
b.sort()
c = {}
(i, j) = (0, 0)
w = 0
while i < len(q) and j < len(a):
	if w < b[i] <= w + a[j]:
		c[b[i]] = j + 1
		i += 1
	elif b[i] > w + a[j]:
		w += a[j]
		j += 1
for i in q:
	print(c[i])


def binary_search(data, n, value):
	mid = n // 2
	low = 0
	high = n - 1
	while True:
		if value <= data[mid] and value > data[mid - 1]:
			return mid
		if value > data[mid]:
			low = mid + 1
		else:
			high = mid - 1
		mid = (high + low) // 2
n = int(input())
data = list(map(int, input().split()))
summ_arr = []
summ = 0
summ_arr.append(0)
m = int(input())
data_2 = []
data_2 = list(map(int, input().split()))
index = 1
for i in range(m):
	while data_2[i] > summ:
		summ += data[index - 1]
		summ_arr.append(summ)
		index += 1
	print(binary_search(summ_arr, index, data_2[i]))


import bisect
from itertools import accumulate
import os
import sys
from io import BytesIO, IOBase
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))

def input():
	return sys.stdin.readline().rstrip('\r\n')
n = int(input())
a = list(map(int, input().split()))
p = list(accumulate(a))
m = int(input())
b = list(map(int, input().split()))
for i in range(0, len(b)):
	print(bisect.bisect_left(p, b[i]) + 1)


n = int(input())
d = {}
_min = 1
pile = 1
for e in map(int, input().split()):
	for i in range(_min, _min + e + 1):
		d[i] = pile
	_min += e
	pile += 1
m = int(input())
for q in map(int, input().split()):
	print(d[q])


import bisect
n = int(input())
a = list(map(int, input().split()))
a.insert(0, 0)
for i in range(1, n + 1):
	a[i] += a[i - 1]
q = int(input())
b = list(map(int, input().split()))
for i in range(q):
	b[i] = bisect.bisect_left(a, b[i])
for i in range(q):
	print(b[i])


p = int(input())
worms = list(map(int, input().split()))
c = int(input())
lab = list(map(int, input().split()))
piles = []
a1 = 0
for i in range(p):
	for j in range(a1 + 1, a1 + worms[i] + 1):
		piles.append(i + 1)
	a1 = a1 + worms[i]
for i in range(c):
	print(piles[lab[i] - 1])


import bisect as bs
n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
for i in range(1, n):
	a[i] += a[i - 1]
for i in range(m):
	print(bs.bisect_left(a, b[i]) + 1)


from time import time
n = int(input())
a = list(map(int, input().split(' ')))
m = int(input())
q = list(map(int, input().split(' ')))

def search(l, n, s, e):
	if s == e:
		return s
	if s + 1 == e:
		if n > l[s]:
			return e
		else:
			return s
	mid = (s + e) // 2
	if n > l[mid]:
		return search(l, n, mid + 1, e)
	else:
		return search(l, n, s, mid)
s = [1]
n = 1
for i in a:
	for j in range(0, i):
		s.append(n)
	n += 1
for i in q:
	print(s[i])


n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))

def memory():
	memorylist = []
	i = 0
	while i < len(a):
		j = 0
		while j < a[i]:
			memorylist.append(i)
			j += 1
		i += 1
	for j in q:
		print(memorylist[j - 1] + 1)
memory()


import bisect
n = int(input())
A = [int(i) for i in input().split()]
m = int(input())
Q = [int(i) for i in input().split()]
for i in range(n - 1):
	A[i + 1] += A[i]
for i in Q:
	m = bisect.bisect_left(A, i) + 1
	print(m)


input()
d = []
m = 1
for i in map(int, input().split()):
	for j in range(i):
		d.append(m)
	m += 1
input()
for i in map(int, input().split()):
	print(d[i - 1])


import bisect
n = int(input())
l = [int(s) for s in input().split()]
m = int(input())
l2 = [int(s) for s in input().split()]
for i in range(1, n):
	l[i] += l[i - 1]
for i in range(m):
	k = bisect.bisect_left(l, l2[i])
	print(k + 1)


def binarySearch(arr, l, r, x):
	while l <= r:
		mid = l + int((r - l) / 2)
		if r == 0:
			return 0
		if arr[mid] >= x and arr[mid - 1] < x:
			return mid
		elif arr[mid] > x:
			r = mid - 1
		else:
			l = mid + 1
	return 0
n = int(input())
list1 = list(map(int, input().split()))
for i in range(1, n):
	list1[i] = list1[i - 1] + list1[i]
input()
for i in input().split():
	ans = binarySearch(list1, 0, n, int(i)) + 1
	print(ans)


def findRange(n, li, l, r):
	mid = l + (r - l) // 2
	if abs(r - l) <= 1:
		return r
	elif n > li[l] and n <= li[mid]:
		return findRange(n, li, l, mid)
	else:
		return findRange(n, li, mid, r)
n = int(input())
a = [0] + ['' for _ in range(n)]
index = 1
s = 0
for num in map(int, input().split()):
	a[index] = num + s
	s = a[index]
	index += 1
m = int(input())
li = list(map(int, input().split()))
for num in li:
	print(findRange(num, a, 0, len(a) - 1))


n = int(input())
ai = [int(i) for i in input().split()]
m = int(input())
qi = [int(i) for i in input().split()]
for i in range(1, n):
	ai[i] = ai[i - 1] + ai[i]
for j in range(m):
	qi[j] = [qi[j], j]
qi.sort(key=lambda x: x[0])
num = 0
t = 0
while t < m:
	if ai[num] >= qi[t][0]:
		qi[t][0] = num + 1
		t = t + 1
	else:
		num = num + 1
qi.sort(key=lambda x: x[1])
for i in qi:
	print(i[0])


from sys import stdin, stdout, setrecursionlimit
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm, accumulate
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
import copy
import time
setrecursionlimit(10 ** 9)
starttime = time.time()
mod = int(pow(10, 9) + 7)
mod2 = 998244353

def data():
	return input()

def num():
	return int(input())

def L():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]

def pmat(A):
	for ele in A:
		print(*ele, end='\n')

def pmat2(A):
	for ele in A:
		for j in ele:
			print(j, end='')
		print()

def iseven(n):
	return n % 2 == 0

def seive(r):
	prime = [1 for i in range(r + 1)]
	prime[0] = 0
	prime[1] = 0
	for i in range(r + 1):
		if prime[i]:
			for j in range(2 * i, r + 1, i):
				prime[j] = 0
	return prime
n = int(data())
ans = 0
a = L()
a = list(accumulate(a))
q = int(data())
for i in input().split():
	ans = bl(a, int(i))
	print(ans + 1)
endtime = time.time()


N = int(input())
worms = list(map(int, input().split()))
Q = int(input())
querys = list(map(int, input().split()))
worm_no = [0]
for (no, num) in enumerate(worms):
	worm_no.extend([no + 1 for i in range(num)])
for q in querys:
	print(worm_no[q])


v = []
n = int(input())
a = map(int, input().split())
r = 1
for k in a:
	v += [r] * k
	r += 1
m = int(input())
q = map(int, input().split())
for j in q:
	print(v[j - 1])


def bsearch(arr, start, end, x):
	m = 0
	while start < end:
		m = (start + end) // 2
		if arr[m] == x:
			return m + 1
		if arr[m] < x:
			start = m + 1
		else:
			end = m
	assert start == end
	return start + 1
n = int(input().strip())
a = list(map(int, input().strip().split(' ')))
m = int(input().strip())
q = list(map(int, input().strip().split(' ')))
for i in range(1, n):
	a[i] += a[i - 1]
for x in q:
	ans = bsearch(a, 0, n, x)
	print(ans)


from bisect import bisect_left
n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
x = [0 for i in range(len(a))]
x[0] = a[0]
for i in range(1, len(a)):
	x[i] = 0 + x[i - 1] + a[i]
for i in b:
	print(bisect_left(x, i) + 1)


n = int(input())
lst_n = list(map(int, input().split()))
m = int(input())
lst_m = list(map(int, input().split()))
L = []
r = 1
for k in lst_n:
	L += [r] * int(k)
	r += 1
for j in lst_m:
	print(L[int(j) - 1])


n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
b = []
for i in range(n):
	b += [i + 1] * a[i]
for i in q:
	print(b[i - 1], end='\n')


from typing import List, Tuple

def parse_input() -> Tuple[int, List[int], int, List[int]]:
	return (int(input()), [int(x) for x in input().split()], int(input()), [int(x) for x in input().split()])

def solve(n: int, a: List[int], m: int, q: List[int]) -> List[int]:
	d = {}
	start = 1
	for (idx, elem) in enumerate(a):
		for pos in range(start, start + elem):
			d[pos] = idx + 1
		start += elem
	return [d[elem] for elem in q]
(n, a, m, q) = parse_input()
for elem in solve(n, a, m, q):
	print(elem)


N = [0 for i in range(1000001)]
n = int(input())
L = list(map(int, input().split()))
j = 0
for i in L:
	N[i + j] = 1
	j = i + j
P = [N[0]]
for i in range(1, 1000001):
	P.append(P[i - 1] + N[i])
k = int(input())
M = list(map(int, input().split()))
for i in range(k):
	print(P[M[i] - 1] + 1)


def bin_search(arr, l, r, val):
	mid = (l + r) // 2
	if arr[mid] >= val and (mid == 0 or arr[mid - 1] < val):
		return mid + 1
	elif arr[mid] < val:
		return bin_search(arr, mid + 1, r, val)
	else:
		return bin_search(arr, l, mid - 1, val)
n = int(input())
arr = list(map(int, input().split()))
lst = [arr[0]]
for i in range(1, n):
	lst += [arr[i] + lst[i - 1]]
m = int(input())
lst1 = list(map(int, input().split()))
for i in range(m):
	print(bin_search(lst, 0, n - 1, lst1[i]))


def search(arr, label):
	low = 0
	high = len(arr)
	while low != high:
		mid = (high + low) // 2
		if arr[mid] < label:
			low = mid + 1
		else:
			high = mid
	return low + 1
n = int(input())
arr = list(map(int, input().split()))
new = []
prev = 0
for num in arr:
	new += [prev + num]
	prev = prev + num
m = int(input())
juicy = list(map(int, input().split()))
for num in juicy:
	print(search(new, num))


n = int(input())
arr = list(map(int, input().split()))
m = int(input())
query = list(map(int, input().split()))
for i in range(1, len(arr)):
	arr[i] += arr[i - 1]

def bs(q):
	(l, r) = (0, len(arr))
	while l < r:
		mid = (l + r) // 2
		if arr[mid] == q:
			return mid + 1
		elif arr[mid] < q:
			l = mid + 1
		else:
			r = mid
	return l + 1
for i in query:
	print(bs(i))


from bisect import bisect_left
n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
label = []
for i in range(len(a)):
	if i == 0:
		x = a[0]
		label.append(x)
	else:
		x = label[i - 1] + a[i]
		label.append(x)
for i in range(len(q)):
	print(bisect_left(label, q[i]) + 1)


from bisect import bisect_left
n = int(input())
a = [int(i) for i in input().split()]
m = int(input())
q = [int(i) for i in input().split()]
sumlist = [a[0]]
i = 1
while i < n:
	k = sumlist[i - 1] + a[i]
	sumlist.append(k)
	i += 1
for i in q:
	y = bisect_left(sumlist, i)
	if y != n:
		print(y + 1)
	else:
		print(n)


from bisect import bisect_left
from itertools import accumulate
R = lambda : map(int, input().split())
n = int(input())
ps = list(accumulate(list(R())))
tn = int(input())
ts = list(R())
for t in ts:
	print(bisect_left(ps, t) + 1)


n = int(input())
wormst = list(map(int, input().split()))
soma = sum(wormst)
worms = [0] * (soma + 1)
pre = 0
for i in range(len(wormst)):
	start = pre + 1
	end = start + wormst[i] - 1
	pre = end
	for k in range(start, end + 1):
		worms[k] = i + 1
q = int(input())
queries = list(map(int, input().split()))
for i in queries:
	print(worms[i])


n = int(input())
a = list(map(int, input().strip().split(' ')))
aq = [0]
for i in range(1, n + 1):
	aq += [i] * a[i - 1]
m = int(input())
q = list(map(int, input().strip().split(' ')))
for i in q:
	print(aq[i])


n = int(input())
l = list(map(int, input().strip().split()))
m = int(input())
arr = list(map(int, input().strip().split()))
a = []
for (i, x) in enumerate(l):
	for _ in range(x):
		a.append(i + 1)
for j in arr:
	print(a[j - 1])


from itertools import accumulate as CS

def bin_search(val):
	lo = 0
	hi = n - 1
	while hi >= lo:
		mid = lo + (hi - lo) // 2
		if cs[mid] == val:
			return mid
		elif cs[mid] > val:
			if cs[mid - 1] < val:
				return mid
			hi = mid - 1
		else:
			if cs[mid + 1] >= val:
				return mid + 1
			lo = mid + 1
	return mid
n = int(input())
piles = [int(i) for i in input().split()]
m = int(input())
juicy = [int(i) for i in input().split()]
cs = list(CS(piles))
for i in juicy:
	print(bin_search(i) + 1)


from bisect import bisect_left
from itertools import accumulate

def find_ge(a, x):
	i = bisect_left(a, x)
	if i != len(a):
		return i
n = input()
l1 = list(accumulate(list(map(int, input().split()))))
q = input()
l2 = list(map(int, input().split()))
for i in l2:
	print(find_ge(l1, i) + 1)


def sear(a, low, high, num):
	mid = (low + high) // 2
	if num <= ans[mid] and num > ans[mid - 1]:
		return mid
	elif num > ans[mid]:
		return sear(a, mid + 1, high, num)
	else:
		return sear(a, low, mid - 1, num)
n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
ans = []
temp = 0
for i in range(n):
	ans.append(a[i] + temp)
	temp = ans[i]
for i in range(m):
	if b[i] <= ans[0]:
		print(1)
		continue
	print(sear(a, 1, n, b[i]) + 1)


import sys

def binarySearch(arr, val):
	l = 0
	r = len(arr)
	while l < r - 1:
		m = int((l + r) / 2)
		if arr[m] < val:
			l = m
		else:
			r = m
	return r
n = int(sys.stdin.readline())
z = [int(x) for x in sys.stdin.readline().split()]
an = []
for i in range(n):
	k = z[i]
	while k > 0:
		an.append(i + 1)
		k -= 1
m = int(sys.stdin.readline())
qm = [int(x) for x in sys.stdin.readline().split()]
for i in qm:
	print(an[i - 1])


import bisect
a = int(input())
piles = list(map(int, input().split()))
b = input()
worms = list(map(int, input().split()))
for i in range(1, a):
	piles[i] = piles[i] + piles[i - 1]
for worm in worms:
	print(bisect.bisect_left(piles, worm) + 1)


from bisect import bisect_left as lbis
n = int(input())
ls = list(map(int, input().split()))
bis = [0]
for i in ls:
	bis.append(bis[-1] + i)
bis = bis[1:]
ls = bis
m = int(input())
ls = list(map(int, input().split()))
for i in ls:
	print(lbis(bis, i) + 1)


import bisect
n = int(input())
c = [0] * (n + 1)
for (i, x) in enumerate(map(int, input().split()), 1):
	c[i] = c[i - 1] + x
m = int(input())
for i in map(int, input().split()):
	print(bisect.bisect_right(c, i - 1))


n = int(input())
a = [int(x) for x in input().split()]
lookup = []
m = 0
for x in a:
	m += 1
	for i in range(x):
		lookup.append(m)
s = int(input())
b = [int(x) for x in input().split()]
for x in b:
	print(lookup[x - 1])


import bisect
n = int(input())
piles = list(map(int, input().split()))
m = int(input())
juicy = list(map(int, input().split()))
for i in range(1, n):
	piles[i] = piles[i - 1] + piles[i]
for j in juicy:
	idx = bisect.bisect_left(piles, j)
	print(idx + 1)


def sortFst(val):
	return val[0]

def sortScd(val):
	return val[1]
a = int(input())
b = input().split()
c = int(input())
d = input().split()
dtrix = []
for i in range(len(d)):
	dtrix.append([int(d[i]), i, 0])
dtrix.sort(key=sortFst)
matrix = []
atual = 0
for i in b:
	matrix.append([atual + 1, atual + int(i)])
	atual += int(i)
last = 0
for i in range(len(dtrix)):
	for ii in range(last, len(matrix), 1):
		if int(dtrix[i][0]) >= int(matrix[ii][0]) and int(dtrix[i][0]) <= int(matrix[ii][1]):
			dtrix[i][2] = ii
			last = ii
			break
dtrix.sort(key=sortScd)
for i in dtrix:
	print(i[2] + 1)


n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
pref = [0 for i in range(n)]
pref[0] = a[0]
for i in range(1, n):
	pref[i] = pref[i - 1] + a[i]
pref = [0] + pref
for x in q:
	l = 0
	r = n
	while l <= r:
		mid = (l + r) // 2
		if x > pref[mid] and x <= pref[r]:
			l = mid
		elif x <= pref[mid] and x >= pref[l]:
			r = mid
		if r - l <= 1:
			print(r)
			break


import bisect
n = int(input())
ls = list(map(int, input().split()))
for i in range(1, n):
	ls[i] += ls[i - 1]
q = int(input())
lq = list(map(int, input().split()))
for item in lq:
	print(bisect.bisect_left(ls, item) + 1)


from bisect import bisect_left
n = int(input())
ai = [int(x) for x in input().split()]
m = int(input())
mi = [int(x) for x in input().split()]
for i in range(1, n):
	ai[i] = ai[i - 1] + ai[i]

def getPile(m):
	low = 0
	high = n - 1
	while low <= high:
		mid = (low + high) // 2
		if m < ai[mid]:
			high = mid - 1
		elif m > ai[mid]:
			low = mid + 1
		else:
			return mid
	if m < ai[mid]:
		return mid
	else:
		return mid + 1
for el in mi:
	print(bisect_left(ai, el) + 1)


input()
l = []
r = 1
for i in input().split():
	l += [r] * int(i)
	r += 1
input()
for j in input().split():
	print(l[int(j) - 1])


def bsearch_left(arr, target):
	lo = 0
	hi = len(arr) - 1
	ans = -1
	while lo <= hi:
		mid = (lo + hi) // 2
		if arr[mid] >= target:
			ans = mid
			hi = mid - 1
		else:
			lo = mid + 1
	return ans
n = int(input())
a = list(map(int, input().split(' ')))
ps = []
for i in range(len(a)):
	if i == 0:
		ps.append(a[i])
	else:
		ps.append(ps[i - 1] + a[i])
m = int(input())
q = map(int, input().split(' '))
for x in q:
	print(bsearch_left(ps, x) + 1)


import bisect

def codeforces():
	_ = int(input())
	a = list(map(int, input().split()))
	_ = int(input())
	q = list(map(int, input().split()))
	sum_p = [0 for i in range(len(a) + 1)]
	sum_p[1] = a[0]
	for i in range(2, len(a) + 1):
		sum_p[i] += sum_p[i - 1] + a[i - 1]
	result = ''
	for number in q:
		index = bisect.bisect_left(sum_p, number)
		result += str(index) + '\n'
	return result
print(codeforces())


import bisect
N = int(input())
lst = list(map(int, input().split()))
m = int(input())
lst1 = list(map(int, input().split()))
ans = []
x = []
x.append(lst[0])
for i in range(1, len(lst)):
	x.append(lst[i] + x[i - 1])
for j in range(len(lst1)):
	count = 0
	count = bisect.bisect_left(x, lst1[j])
	print(count + 1)


n = int(input())
worms = list(map(int, input().split()))
m = int(input())
juicy = list(map(int, input().split()))
s = []
for i in range(n):
	s += [i] * worms[i]
for i in range(m):
	print(s[juicy[i] - 1] + 1)


n = int(input())
a = [0]
b = list(map(int, input().split()))
for i in range(len(b)):
	for j in range(b[i]):
		a.append(i + 1)
n = int(input())
b = list(map(int, input().split()))
for i in range(len(b)):
	print(a[b[i]])


import bisect
n = int(input())
w = list(map(int, input().strip().split()))
m = int(input())
q = list(map(int, input().strip().split()))
r = [0]
for i in w:
	r.append(i + r[-1])
r = r[1:]
for k in range(0, m):
	print(bisect.bisect_left(r, q[k]) + 1)


def main():
	heapsC = int(input())
	heaps = list(map(int, input().split(' ')))
	wormsC = int(input())
	worms = list(map(int, input().split(' ')))
	prev = heaps[0]
	for i in range(1, heapsC):
		heaps[i] = heaps[i] + prev
		prev = heaps[i]
	for value in worms:
		left = 0
		right = len(heaps) - 1
		while right >= left:
			mid = (left + right) // 2
			if mid == 0 and value >= 0 and (value < heaps[mid - 1]):
				print(mid + 1)
				break
			if value > heaps[mid - 1] and value <= heaps[mid]:
				print(mid + 1)
				break
			elif value > heaps[mid]:
				left = mid + 1
			else:
				right = mid
main()


import copy
n = int(input())
a = list(map(int, input().split()))
d = dict()
x = 1
for i in range(0, n):
	for j in range(0, a[i]):
		d[j + x] = i + 1
	x += a[i]
m = int(input())
q = list(map(int, input().split()))
print(*[d[q[i]] for i in range(0, m)], sep=' \n')


from collections import Counter
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys

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

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

def tinput():
	return input().split()

def rinput():
	return map(int, tinput())

def rlinput():
	return list(rinput())
mod = int(1000000000.0) + 7

def binsearch(prefix, ele, n):
	(l, r) = (0, n)
	while l <= r:
		mid = l + (r - l) // 2
		if ele <= prefix[mid] and ele > prefix[mid - 1]:
			return mid
		elif ele > prefix[mid]:
			l = mid + 1
		else:
			r = mid - 1
	return -1
n = iinput()
a = rlinput()
m = iinput()
j = rlinput()
prefix = [0]
for i in range(n):
	prefix.append(a[i] + prefix[i])
for i in j:
	print(binsearch(prefix, i, n + 1))


def BS(A, x, l, h):
	if h - l > 0:
		m = (l + h) // 2
		if x < A[m]:
			return BS(A, x, l, m)
		else:
			return BS(A, x, m + 1, h)
	elif x > A[l]:
		return h
	else:
		return l
n = int(input())
A = list(map(int, input().split()))
m = int(input())
B = list(map(int, input().split()))
C = [1]
S = 0
for i in range(n):
	S = S + A[i]
	C.append(S + 1)
C = list(set(C))
for i in range(m):
	print(BS(C, B[i], 0, len(C)))


def binsearch(arr, elem):
	first = 0
	last = len(arr) - 1
	while first <= last:
		mid = (first + last) // 2
		if elem > arr[mid - 1] and elem <= arr[mid]:
			break
		elif arr[mid] > elem:
			last = mid - 1
		else:
			first = mid + 1
	return mid

def main(args):
	n = int(input())
	l = list(map(int, input().split()))
	m = int(input())
	l1 = list(map(int, input().split()))
	m = [0]
	x = 0
	for t in l:
		x += t
		m.append(x)
	for t in l1:
		j = binsearch(m, t)
		print(j)
	return 0
import sys
sys.exit(main(sys.argv))


def binsearch(a, x):
	(l, r) = (0, len(a) - 1)
	ans = len(a)
	while l <= r:
		mid = l + (r - l) // 2
		if a[mid] >= x:
			ans = mid + 1
			r = mid - 1
		else:
			l = mid + 1
	return ans
n = int(input())
a = list(map(int, input().split()))
for i in range(1, n):
	a[i] = a[i] + a[i - 1]
q = int(input())
l = list(map(int, input().split()))
for i in range(q):
	print(binsearch(a, l[i]))


L = []
input()
r = 1
for k in input().split():
	L += [r] * int(k)
	r += 1
input()
for i in list(map(int, input().split())):
	print(L[i - 1])


from bisect import bisect_left
n = int(input())
a = [int(i) for i in input().split()]
for i in range(1, n):
	a[i] += a[i - 1]
m = int(input())
b = [int(i) for i in input().split()]
for i in b:
	print(bisect_left(a, i) + 1)


from bisect import bisect_left
n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
piles = []
first = 0
for i in a:
	piles.append(first + i)
	first += i
for i in q:
	print(bisect_left(piles, i) + 1)


from sys import stdin, stdout

def c_r(arr, l, r, target):
	while l + 1 < r:
		m = (l + r) // 2
		if arr[m] >= target:
			r = m
		else:
			l = m
	return r

def main():
	n = int(stdin.readline().strip())
	A = [int(num) for num in stdin.readline().strip().split()]
	P_A = [A[0]]
	for i in A[1:]:
		P_A.append(P_A[-1] + i)
	m = int(stdin.readline().strip())
	outputs = []
	for i in (int(num) for num in stdin.readline().strip().split()):
		index = c_r(P_A, -1, n, i)
		outputs.append(f'{index + 1}')
	stdout.write(' '.join(outputs))
main()


n = int(input())
arr = [int(x) for x in input().split(' ')]
m = int(input())
labels = [int(x) for x in input().split(' ')]
buckets = []
for (i, a) in enumerate(arr):
	for _ in range(a):
		buckets.append(i)
for q in labels:
	print(buckets[q - 1] + 1)


n = int(input())
pile = [int(x) for x in input().split()]
m = int(input())
temp = [int(x) for x in input().split()]
temp[0] = [temp[0], 0]
spile = [pile[0]]
for i in range(1, n):
	spile.append(spile[-1] + pile[i])
for i in range(1, m):
	temp[i] = [temp[i], i]
temp = sorted(temp, key=lambda x: x[0])
cnt = 0
j = 0
while j < m:
	if spile[cnt] >= temp[j][0]:
		temp[j][0] = cnt + 1
		j += 1
	else:
		cnt += 1
temp = sorted(temp, key=lambda x: x[1])
for i in temp:
	print(i[0])


n = int(input())
line = str(input()).split()
line = [int(it) for it in line]
value = list()
for i in range(n):
	value.extend([i] * line[i])
m = int(input())
line = str(input()).split()
line = [int(it) for it in line]
for i in range(m):
	print(value[line[i] - 1] + 1)


__author__ = 'Juan Barros'

def solve(n, a):
	result = []
	sum = []
	sumAux = 0
	for i in n:
		sumAux += i
		sum.append(sumAux)
	size = len(n)
	for e in a:
		result.append(binarySearch(sum, 0, size - 1, e) + 1)
	return result

def binarySearch(arr, l, r, x):
	if r >= l:
		mid = int(l + (r - l) / 2)
		if arr[mid] == x:
			return mid
		elif arr[mid] > x:
			return binarySearch(arr, l, mid - 1, x)
		else:
			return binarySearch(arr, mid + 1, r, x)
	else:
		return l
input()
n = [int(element) for element in input().split(' ')]
input()
a = [int(element) for element in input().split(' ')]
bests = solve(n, a)
for i in bests:
	print(i)


import bisect
n = int(input())
ps = list(map(int, input().split()))
m = int(input())
qs = list(map(int, input().split()))
rs = [0]
for p in ps:
	rs.append(rs[-1] + p)
for q in qs:
	print(bisect.bisect_left(rs, q))


from bisect import bisect_left
n = int(input())
a = list(map(int, input().split()))
input()
q = list(map(int, input().split()))
for i in range(1, n):
	a[i] += a[i - 1]
ans = ''
for item in q:
	ans += f'{bisect_left(a, item) + 1}\n'
print(ans)


import bisect
n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))

def search(seq, v, low, high):
	while low < high:
		mid = (low + high) // 2
		if v <= seq[mid]:
			high = mid
		else:
			low = mid + 1
	return low

def fast():
	i = 0
	su = 0
	while i < len(a):
		su += a[i]
		a[i] = su
		i += 1
	for j in q:
		print(bisect.bisect_left(a, j) + 1)
fast()


n = int(input())
list = input().split()
ans = dict()
cnt = 0
for i in range(n):
	for j in range(int(list[i])):
		cnt += 1
		ans[cnt] = i + 1
n = int(input())
list = input().split()
for i in list:
	print(ans[int(i)])


def main():
	p = int(input())
	ps = [int(x) for x in input().split()]
	j = int(input())
	js = [int(x) for x in input().split()]
	worms = [1] * ps[0]
	for i in range(1, p):
		worms.extend([i + 1] * ps[i])
	for jw in js:
		print(worms[jw - 1])
main()


def bsearch(arr, target):
	start = 0
	end = len(arr) - 1
	while start <= end:
		mid = (start + end) // 2
		if target > arr[mid]:
			start = mid + 1
		elif target < arr[mid]:
			end = mid - 1
		else:
			return mid
	return start
n = int(input())
a1 = list(map(int, input().split()))
m = int(input())
a2 = list(map(int, input().split()))
r = []
s = 0
for i in range(n):
	s += a1[i]
	r.append(s)
for i in a2:
	print(bsearch(r, i) + 1)


import bisect
n = int(input())
worms = list(map(int, input().split(' ')))
m = int(input())
labels = list(map(int, input().split(' ')))
pile_labels = []
for i in range(len(worms)):
	if i == 0:
		pile_labels.append(worms[0])
	else:
		value = pile_labels[i - 1] + worms[i]
		pile_labels.append(value)
for i in labels:
	answer = bisect.bisect_left(pile_labels, i)
	print(answer + 1)


import math
from collections import defaultdict, Counter, deque
INF = float('inf')

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def isPrime(n):
	if n <= 1:
		return False
	i = 2
	while i ** 2 <= n:
		if n % i == 0:
			return False
		i += 1
	return True

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

def array():
	return list(map(int, input().split()))
import random

def main():
	n = int(input())
	arr = array()
	m = int(input())
	mo = array()
	for i in range(1, n):
		arr[i] += arr[i - 1]
	for i in mo:
		l = 0
		r = n - 1
		while l <= r:
			m = (l + r) // 2
			if arr[m] == i:
				l = m
				break
			elif arr[m] < i:
				l = m + 1
			else:
				r = m - 1
		print(l + 1)
t = 1
for _ in range(t):
	main()


I = lambda : map(int, input().split())
n = int(input())
a = list(I())
s = 0
start = 1
res = [0] * 1000001
x = 1
for i in range(n):
	s += a[i]
	for j in range(start, s + 1):
		res[j] = x
	x += 1
	start = s + 1
m = int(input())
b = list(I())
for i in range(m):
	print(res[b[i]])


n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
a1 = [a[0]]
for i in range(1, n):
	a1.append(a[i] + a1[i - 1])
l = [0] * (max(q) + 1)
j = 1
for i in range(len(l)):
	if i <= a1[j - 1]:
		l[i] = j
	else:
		j += 1
		l[i] = j
for i in range(m):
	print(l[q[i]])


L = []
input()
p = 1
for i in input().split():
	L += [p] * int(i)
	p += 1
input()
for i in input().split():
	print(L[int(i) - 1])


def pro():
	n = int(input())
	a = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	sm = []
	p = 0
	for i in range(n):
		p += a[i]
		sm.append(p)

	def bs(q, o):
		l = -1
		r = n
		while r - l > 1:
			m = (r + l) // 2
			if o <= sm[m]:
				r = m
			else:
				l = m
		print(r + 1)
	for i in q:
		bs(a, i)
pro()


from itertools import accumulate
n = int(input())
l = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
acc = list(accumulate(l))
ans = []
for i in range(n):
	ans.extend([i + 1] * l[i])
for i in q:
	print(ans[i - 1])


(z, zz) = (input, lambda : list(map(int, z().split())))
(szz, dgraphs, mod) = (lambda : sorted(zz()), {}, 10 ** 9 + 7)
from string import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
n = int(z())
l = list(ac(zz()))
m = int(z())
li = zz()
for i in li:
	p = bs(l, i)
	if i <= l[0]:
		print(1)
		continue
	if i >= l[-1]:
		print(n)
		continue
	if i == l[p - 1]:
		print(p)
	else:
		print(min(p + 1, n))


a = int(input())
list1 = list(map(int, input().split()))
b = int(input())
list2 = list(map(int, input().split()))
list3 = [(i + 1, list2[i]) for i in range(b)]
list3.sort(key=lambda x: x[1])
dic1 = {}
output = []
for i in range(a):
	dic1[i + 1] = (dic1[i][1] + 1, dic1[i][1] + list1[i]) if i != 0 else (1, list1[0])
count = 0
j = 1
while 1:
	flag = 1
	if list3[count][1] <= dic1[j][1] and list3[count][1] >= dic1[j][0]:
		output.append((list3[count][0], j))
		count += 1
	else:
		j += 1
	if count + 1 > b:
		break
output.sort(key=lambda x: x[0])
for i in range(0, b):
	print(output[i][1])


n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
d = {}
t = 1
for i in range(n):
	for j in range(t, t + a[i]):
		d[j] = i + 1
	t += a[i]
for i in range(m):
	print(d[b[i]])


n = int(input())
x = []
x = input().split()
ps = []
ps.append(int(x[0]))
for i in range(1, n):
	ps.append(int(x[i]) + ps[i - 1])
m = int(input())
x = input().split()
for i in range(m):
	(b, l) = (0, n - 1)
	while b < l:
		mid = (b + l) // 2
		if int(x[i]) <= ps[mid]:
			l = mid
		else:
			b = mid + 1
	print(l + 1)


n = int(input())
a = input().split(' ')
s = [int(a[0])]
for i in range(1, n):
	s.append(s[i - 1] + int(a[i]))
m = int(input())
q = list(map(int, input().split(' ')))
q = list(zip(q, range(m)))
q.sort()
q.append((1000001, m))
j = 0
ans = [0] * m
for i in range(n):
	while s[i] >= q[j][0]:
		ans[q[j][1]] = i + 1
		j += 1
	if j == m:
		break
for x in ans:
	print(x)


import bisect
input()
pos = list(map(int, input().split()))
for i in range(1, len(pos)):
	pos[i] += pos[i - 1]
input()
q = list(map(int, input().split()))
for i in q:
	print(bisect.bisect_left(pos, i) + 1)


trash = int(input())
firstLine = [int(x) for x in input().split()]
trash = int(input())
secondLine = [int(x) for x in input().split()]
worms = []
for i in range(0, len(firstLine)):
	for j in range(0, firstLine[i]):
		worms.append(i)
for i in secondLine:
	print(worms[i - 1] + 1)


n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
s = [0]
for i in range(n):
	for k in range(a[i]):
		s.append(i + 1)
for j in q:
	print(s[j])


import bisect
n = int(input())
a = list(map(int, input().split()))
juicy = int(input())
num = list(map(int, input().split()))
b = num.copy()
temp = 0
prefixarray = []
for i in range(len(a)):
	temp = temp + a[i]
	prefixarray.append(temp)
for i in range(len(b)):
	print(bisect.bisect_left(prefixarray, b[i]) + 1)


n = int(input())
piles = list(map(int, input().split()))
m = int(input())
num = list(map(int, input().split()))
num2 = sorted(num)
cnt = piles[0]
seq = 1
dic = {}
while num2:
	if num2[0] <= cnt:
		dic[num2[0]] = seq
		del num2[0]
	else:
		cnt += piles[seq]
		seq += 1
for i in range(m):
	print(dic[num[i]])


n = int(input())
A = [int(x) for x in input().split()]
B = [0] * n
for i in range(1, n):
	A[i] += A[i - 1]
m = int(input())
B = [int(x) for x in input().split()]

def find(x, q):
	first = 0
	last = len(x)
	while first < last:
		mid = (first + last) // 2
		if x[mid] < q:
			first = mid + 1
		else:
			last = mid
	if first == len(x):
		return first
	return first + 1
for i in range(m):
	print(find(A, B[i]))


def bs(v, a):
	(lo, hi) = (0, len(a) - 1)
	r = -1
	while lo <= hi:
		mi = lo + (hi - lo) // 2
		if a[mi] >= v:
			r = mi
			hi = mi - 1
		else:
			lo = mi + 1
	return r
n = int(input())
a = list(map(int, input().split()))
for i in range(1, n):
	a[i] += a[i - 1]
input()
for x in list(map(int, input().split())):
	print(1 + bs(x, a))


L1 = []
input()
r = 1
for k in input().split(' '):
	L1 += [r] * int(k)
	r += 1
input()
for j in input().split(' '):
	print(L1[int(j) - 1])


n = input()
A = list((int(i) for i in input().split()))
m = input()
Q = list((int(i) for i in input().split()))
piles = []
i = 1
for wnum in A:
	piles += [i] * wnum
	i += 1
for q in Q:
	print(piles[q - 1])


from sys import stdin
from bisect import bisect_left as bisect
from itertools import accumulate
test_case = stdin.readlines()
worms = [int(c) for c in test_case[1].split()]
queries = [int(c) for c in test_case[3].split()]
worms_acc = list(accumulate(worms))
for q in queries:
	idx = bisect(worms_acc, q)
	print(idx + 1)


from sys import stdin

def lee():
	n = int(stdin.readline())
	worms = [int(x) for x in stdin.readline().split()]
	m = int(stdin.readline())
	labels = [int(x) for x in stdin.readline().split()]
	dic = dicc(n, worms)
	imp(dic, labels)

def dicc(n, worms):
	(num, c) = (0, 0)
	p = {}
	for f in range(len(worms)):
		c = 0
		while c < worms[f]:
			p[num + 1] = f + 1
			num += 1
			c += 1
	return p

def imp(dic, labels):
	for x in range(len(labels)):
		print(dic[labels[x]])
lee()


n = int(input())
lst = list((int(num) for num in input().split()))[:n]
m = int(input())
lst1 = list((int(num) for num in input().split()))[:m]
lstworm = []
index = 1
for i in range(0, len(lst)):
	for j in range(0, lst[i]):
		lstworm.append(index)
	index += 1
for i in range(0, len(lst1)):
	x = lst1[i]
	print(lstworm[x - 1])


def bs(lista, numero):
	izq = 0
	der = len(lista) - 1
	while izq != der:
		med = (izq + der) // 2
		if lista[med] >= numero:
			der = med
		else:
			izq = med + 1
	return izq
n = int(input())
lista = []
for i in input().split(' '):
	lista.append(int(i))
lista_sumas = [lista[0]]
for i in range(1, n):
	lista_sumas.append(lista[i] + lista_sumas[-1])
m = int(input())
for i in input().split(' '):
	print(bs(lista_sumas, int(i)) + 1)


import bisect
t = int(input())
p = list(map(int, input().split()))
m = int(input())
a = list(map(int, input().split()))
b = [0]
s = 0
for i in range(len(p)):
	s = s + p[i]
	b.append(s)
for j in range(len(a)):
	print(bisect.bisect_left(b, a[j]))


n = int(input())
aa = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
a = [0]
for i in range(n):
	for j in range(aa[i]):
		a.append(i + 1)
for qq in q:
	print(a[qq])


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nlargest, nsmallest, _heapify_max, _heapreplace_max
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque, Counter as c
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from fractions import Fraction
mod = pow(10, 9) + 7
mod2 = 998244353

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

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
n = int(data())
arr = l()
m = int(data())
q = l()
ranges = []
for i in range(1, n):
	arr[i] += arr[i - 1]
for i in q:
	temp = br(arr, i)
	if temp == n:
		temp -= 1
	if temp > 0:
		if arr[temp - 1] == i:
			out(temp)
			continue
	out(temp + 1)


n = int(input())
sp = list(map(int, input().split()))
for i in range(1, n):
	sp[i] = sp[i - 1] + sp[i]
t = int(input())
k = list(map(int, input().split()))
for i in k:
	l = 0
	r = n - 1
	while l != r:
		mid = (l + r) // 2
		if sp[mid] >= i:
			r = mid
		else:
			l = mid + 1
	print(l + 1)


import sys
import io
import os
import bisect
total = 0
failed = 0

def debug(a):
	print(a, file=sys.stderr)

def run(test, res):
	x = io.StringIO()
	with io.StringIO(test) as sys.stdin:
		with x as sys.stdout:
			work()
			z = x.getvalue().strip()
	sys.stdout = sys.__stdout__
	print('Passed?', z == res)
	print('Expected: ', res)
	print('Actual  : ', z)
	global total, failed
	total += 1
	failed += 1 if z != res else 0

def work():
	n = int(input())
	a = list(map(int, input().split()))
	b = [0] * n
	for (i, e) in enumerate(a):
		b[i] = e + (0 if i == 0 else b[i - 1])
	m = int(input())
	q = list(map(int, input().split()))
	for e in q:
		print(1 + bisect.bisect_left(b, e))

def test():
	run('5\n2 7 3 4 9\n3\n1 25 11', '1\n5\n3')
if 'LOCALTEST' in os.environ:
	test()
	print('\n Result: %s (%d total, %d failed)' % ('FAILED' if failed > 0 else 'PASSED', total, failed))
else:
	work()


n = int(input())
vals = input().split()
a = [int(val) for val in vals]
m = int(input())
vals = input().split()
q = [int(val) for val in vals]
seq = []
pile = 1
for a_i in a:
	seq += [pile] * a_i
	pile += 1
for q_i in q:
	print(seq[q_i - 1])


n = int(input())
li = []
index = 1
for i in map(int, input().split()):
	li += [index] * i
	index += 1
m = int(input())
for query in map(int, input().split()):
	print(li[query - 1])


n = int(input())
piles = list(map(int, input().split()))
m = int(input())
worms = []
i = 1
for j in list(map(int, input().split())):
	worms.append([i, j])
	i += 1
worms.sort(key=lambda x: x[1])
(k, i, tag) = (0, 0, 0)
sum_worms = 0
while k < n and tag == 0:
	sum_worms += piles[k]
	while worms[i][1] <= sum_worms:
		if i < m - 1:
			worms[i][1] = k + 1
			i += 1
		elif i == m - 1:
			worms[i][1] = k + 1
			tag = 1
			break
	k += 1
worms.sort(key=lambda x: x[0])
for element in worms:
	print(element[1])


n = int(input())
a = [int(i) for i in input().split()]
m = int(input())
q = [int(i) for i in input().split()]
worm = []
for i in range(n):
	for j in range(a[i]):
		worm.append(i + 1)
for i in range(m):
	print(worm[q[i] - 1])


from bisect import bisect_left

def BinarySearch(a, x):
	i = bisect_left(a, x)
	print(i + 1)
n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
for i in range(1, n):
	a[i] += a[i - 1]
for items in b:
	BinarySearch(a, items)


num_heaps = int(input())
worms_per_heap = [int(x) for x in input().split()]
worm = 1
wpdict = {}
for heap in range(1, num_heaps + 1):
	for i in range(1, worms_per_heap[heap - 1] + 1):
		wpdict[worm] = heap
		worm += 1
num_tasty_worms = int(input())
tasty_worms = [int(x) for x in input().split()]
for worm in tasty_worms:
	print(wpdict[worm])


from bisect import bisect_left
n = int(input())
worm_sums = list(map(int, input().split()))
for i in range(n - 1):
	worm_sums[i + 1] += worm_sums[i]
input()
for q in map(int, input().split()):
	print(bisect_left(worm_sums, q) + 1)


n = int(input())
b = []
a = list(map(int, input().split()))
r = 1
for k in a:
	b += [r] * int(k)
	r += 1
m = int(input())
x = list(map(int, input().split()))
for i in x:
	print(b[i - 1])


from bisect import bisect_left as bl
n = int(input())
a = [int(x) for x in input().split()]
m = int(input())
pos = [int(x) for x in input().split()]
for i in range(1, n):
	a[i] += a[i - 1]
for i in range(m):
	print(bl(a, pos[i]) + 1)


num1 = int(input())
list1 = [int(k) for k in input().split()]
num2 = int(input())
list2 = [int(k) for k in input().split()]
sum_list = [0] * (num1 + 1)
for k in range(num1):
	sum_list[k + 1] = sum_list[k] + list1[k]

def binary_search(list, num):
	first_bound = 0
	last_bound = len(list) - 1
	while True:
		temp = int((first_bound + last_bound) / 2)
		if temp == first_bound:
			return last_bound
		elif list[temp] < num:
			first_bound = temp
		else:
			last_bound = temp
output_list = [binary_search(sum_list, num) for num in list2]
for k in output_list:
	print(k)


from sys import stdin, stdout
from bisect import *
input = stdin.read()
(n, ai_str, m, qi_str) = [_f for _f in input.split('\n') if _f]
a = list(map(int, ai_str.split()))
q = list(map(int, qi_str.split()))
assert len(a) > 0 and len(q) > 0
b = [0] * len(a)
for (i, ai) in enumerate(a):
	b[i] = b[i - 1] + ai
for qi in q:
	print(bisect_left(b, qi) + 1)


n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
x = sum(a)
pileNo = [0] * x
j = 0
for i in range(x):
	if a[j] == 0:
		j += 1
	a[j] -= 1
	pileNo[i] = j + 1
for i in range(m):
	print(pileNo[q[i] - 1])


import sys
from math import sqrt
mod = 1000000007
n = 1000000

def get_array():
	return list(map(int, sys.stdin.readline().split()))

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

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

def print_array(a):
	print(' '.join(map(str, a)))

def bsearch(a, n, p):
	(start, end) = (0, n - 1)
	while True:
		k = (start + end) // 2
		if a[k] == p:
			return k
		elif end - start < 1:
			return start
		elif a[k] > p:
			end = k
		else:
			start = k + 1

def main():
	n = int(input())
	a = get_array()
	for i in range(1, n):
		a[i] += a[i - 1]
	m = int(input())
	q = get_array()
	for i in range(m):
		print(bsearch(a, n, q[i]) + 1)
main()


n = int(input())
heap = list(map(int, input().split(' ')))
m = int(input())
nums = list(map(int, input().split(' ')))
originNums = nums.copy()
nums.sort()
heaps = []
previousNumber = 1
for i in range(n):
	heaps.append((previousNumber, previousNumber + heap[i] - 1))
	previousNumber = previousNumber + heap[i]
result = {}
heapNumber = 0
numNumber = 0
for i in range(m):
	while nums[i] > heaps[heapNumber][1]:
		heapNumber += 1
	result[nums[i]] = heapNumber + 1
for i in range(m):
	print(result[originNums[i]])


import bisect
n = int(input())
arr = [0]
for x in input().split():
	arr.append(arr[-1] + int(x))
q = int(input())
queries = [int(x) for x in input().split()]
for x in queries:
	pos = bisect.bisect_left(arr, x)
	print(pos)


from sys import stdin, stdout

def get_inter(piles, n):
	res = [(1, piles[0])]
	s = piles[0]
	for i in range(1, n):
		s += piles[i]
		res.append((res[i - 1][1] + 1, s))
	return res

def binarySearch(arr, l, r, x):
	while l <= r:
		mid = l + (r - l) // 2
		if x >= arr[mid][0] and x <= arr[mid][1]:
			return mid
		elif arr[mid][1] < x:
			l = mid + 1
		elif arr[mid][0] > x:
			r = mid - 1
		else:
			return None
	return -1

def solve(piles, worms, n, m):
	inter_piles = get_inter(piles, n)
	res = ''
	for w in worms:
		res += str(binarySearch(inter_piles, 0, n - 1, w) + 1) + '\n'
	return res.strip()
n = int(stdin.readline().rstrip())
piles = list(map(int, input().rstrip().split()))
m = int(stdin.readline().rstrip())
worms = list(map(int, input().rstrip().split()))
stdout.write(str(solve(piles, worms, n, m)))


from bisect import bisect_left as br
n = int(input())
l = list(map(int, input().split()))
a = []
s = 0
for i in range(n):
	s += l[i]
	a.append(s)
m = int(input())
q = list(map(int, input().split()))
for i in range(m):
	x = br(a, q[i])
	print(x + 1)


from heapq import merge
import datetime
import math

def clock():
	print(datetime.datetime.now())
input()
a = [int(x) for x in input().split()]
input()
b = [int(x) for x in input().split()]
c = []
for i in range(len(a)):
	c += [i] * a[i]
for q in b:
	print(c[q - 1] + 1)


def find(b, a, start, end, le):
	mid = int((start + end) / 2)
	if mid == le - 1:
		print(mid)
		return mid
	if a[mid] < b and b <= a[mid + 1]:
		return mid + 1
	if b == a[mid]:
		return mid
	if a[mid + 1] < b:
		return find(b, a, mid, end, le)
	if a[mid] > b:
		return find(b, a, start, mid, le)
n = int(input())
a = list(map(int, input().split()))
for i in range(1, n):
	a[i] += a[i - 1]
m = int(input())
q = list(map(int, input().split()))
for i in range(m):
	if q[i] <= a[0]:
		print(1)
	elif q[i] > a[n - 2] and q[i] <= a[n - 1]:
		print(n)
	else:
		print(find(q[i], a, 0, n, n) + 1)


numOfPiece = int(input())
numOfWorm = [int(x) for x in input().split(' ')]
numOfChoose = int(input())
chooseWorm = [int(x) for x in input().split(' ')]
c_numOfWorm = []
a = 0
b = []
for i in range(0, len(numOfWorm)):
	for j in range(0, int(numOfWorm[i])):
		b.append(i)
for i in range(0, numOfChoose):
	print(b[chooseWorm[i] - 1] + 1)


input()
a = []
r = 1
for k in input().split():
	a += [r] * int(k)
	r += 1
input()
for k in input().split():
	print(a[int(k) - 1])


n = int(input())
a = list(map(int, input().split()))
for i in range(1, n):
	a[i] += a[i - 1]
k = int(input())
items = list(map(int, input().split()))
for x in items:
	l = 0
	r = n
	while l < r:
		m = l + (r - l) // 2
		if a[m] >= x:
			r = m
		else:
			l = m + 1
		if a[m] == x:
			break
	print(r + 1)


n = int(input())
a = [int(i) for i in input().split()]
ans = []
i = 1
for elem in a:
	while elem > 0:
		ans.append(i)
		elem -= 1
	i += 1
m = int(input())
b = [int(i) for i in input().split()]
for elem in b:
	print(ans[elem - 1])


n = int(input())
a = [int(i) for i in input().split()]
m = int(input())
q = [int(i) for i in input().split()]
q = [[q[i], i] for i in range(m)]
q.sort()
x = 0
h = [0] * m
j = 0
for i in range(n):
	if j == m:
		break
	x += a[i]
	if x >= q[j][0]:
		kk = True
		while kk:
			h[q[j][1]] = i + 1
			j += 1
			if j == m:
				kk = False
				break
			if x < q[j][0]:
				kk = False
				break
print(*h)


input()
data = list(map(int, input().split(' ')))
temp = []
t = 0
for i in data:
	t += i
	temp.append(t)
input()
search_data = list(map(int, input().split(' ')))
sorted_search_data = sorted(search_data)
res = {}
len_search_data = len(search_data)
j = 0
for i in sorted_search_data:
	while i > temp[j]:
		j += 1
	res[i] = j + 1
for i in search_data:
	print(res[i])


n = int(input())
l = list(map(int, input().split()))
a = []
k = 1
mp = {}
for i in range(n):
	for j in range(k, k + l[i]):
		mp[j] = i + 1
	k = k + l[i]
m = int(input())
q = list(map(int, input().split()))
for value in q:
	print(mp[value])


n = int(input())
arr = list(map(int, input().strip().split(' ')))
m = int(input())
q = list(map(int, input().strip().split(' ')))
lis = [0]
for (index, num) in enumerate(arr):
	lis += [index + 1 for _ in range(num)]
res = []
for i in q:
	res.append(str(lis[i]))
print('\n'.join(res))


mp = {}

def main():
	(a, b) = (-1, 0)
	n = int(input())
	line = input()
	x = line.split()
	for i in range(n):
		a = b
		b = b + int(x[i])
		for k in range(a + 1, b + 1):
			mp[k] = 1 + i
	m = int(input())
	line = input()
	q = line.split()
	for i in range(m):
		print(mp[int(q[i])])
main()


n = int(input())
a = [int(x) for x in input().split()]
m = int(input())
l = [int(y) for y in input().split()]
ans = []
k = 0
for i in range(n):
	ans += [i + 1] * a[i]
for i in range(m):
	print(ans[l[i] - 1])


n = int(input())
N = [int(i) for i in input().split()]
k = 1
d = {}
for i in range(n):
	for j in range(N[i]):
		d[k] = i + 1
		k += 1
m = int(input())
M = [int(i) for i in input().split()]
for i in range(m):
	print(d[M[i]])


from sys import stdin

def binary(num, n):
	global dor
	(lo, hi) = (0, n)
	while lo < hi:
		mid = lo + (hi - lo) // 2
		if dor[mid] >= num:
			hi = mid
		else:
			lo = mid + 1
	return lo

def main():
	global dor
	n = int(stdin.readline().strip())
	dor = [int(x) for x in stdin.readline().strip().split()]
	for i in range(1, n):
		dor[i] = dor[i] + dor[i - 1]
	m = int(stdin.readline())
	letters = [int(x) for x in stdin.readline().strip().split()]
	for i in letters:
		x = binary(i, n)
		print(x + 1)
main()


n = int(input())
arr = list(map(int, input().split()))
k = int(input())
arr_j = list(map(int, input().split()))
arr_cum = [0 for i in range(n)]
for i in range(n):
	arr_cum[i] = arr[i] + arr_cum[i - 1]

def binarSearch(arr, m):
	l = 0
	r = n - 1
	while l <= r:
		mid = l + (r - l) // 2
		if arr[mid] >= m:
			if arr[mid - 1] < m:
				return mid
			r = mid - 1
		else:
			l = mid + 1
	return mid
for i in range(k):
	print(binarSearch(arr_cum, arr_j[i]) + 1)


n = int(input())
sumi = 0
a = list(map(int, input().split()))
for i in range(n):
	sumi += a[i]
	a[i] = sumi
m = int(input())
q = list(map(int, input().split()))
for p in q:
	start = 0
	end = n - 1
	while True:
		k = (start + end) // 2
		if a[k] == p:
			ans = k
			break
		elif end - start < 1:
			ans = start
			break
		elif a[k] > p:
			end = k
		else:
			start = k + 1
	print(ans + 1)


arr = []
leng = 0

def find(value):
	low = 0
	high = leng - 1
	while high - low != 0:
		med = int((low + high) / 2)
		if value > arr[med]:
			low = med
		else:
			high = med
		if high - low == 1:
			if value <= arr[low]:
				return low + 1
			else:
				return high + 1
n = int(input())
L = list(map(int, input().split(' ')))
S = {}
index = 1
i = 1
for x in L:
	for k in range(0, x):
		S[i] = index
		i += 1
	index += 1
m = int(input())
L = list(map(int, input().split(' ')))
for x in L:
	print(S[x])


n = int(input())
lsn = list(map(int, input().split()))
m = int(input())
lsm = list(map(int, input().split()))
lst = []
c = 0
for i in lsn:
	c = c + i
	lst.append(c)
for j in lsm:
	s = 0
	e = len(lst) - 1
	while 1:
		if e - s == 1:
			print(e + 1)
			break
		mid = int((s + e) / 2)
		if j > lst[s] and j <= lst[mid]:
			e = mid
		elif j >= lst[mid] and j <= lst[e]:
			s = mid
		else:
			print('1')
			break


n = int(input())
a = [0] + list(map(int, input().split()))
q = int(input())
k = list(map(int, input().split()))
for i in range(1, len(a)):
	a[i] += a[i - 1]
v = [0] * (a[-1] + 1)
c = 1
for i in range(1, a[-1] + 1):
	if i > a[c]:
		c += 1
	v[i] = c
for i in k:
	print(v[i])


def binary_search(element, rng):
	start = 0
	end = len(rng)
	while True:
		midle = (end - start) // 2 + start
		if rng[midle][0] <= element and rng[midle][1] >= element:
			return midle + 1
		elif rng[midle][0] > element:
			end = midle
		elif rng[midle][1] < element:
			start = midle
p = int(input())
lst = input().split()
rng = []
for i in lst:
	n = int(i)
	if len(rng) == 0:
		rng.append([1, n])
	else:
		a1 = rng[-1][1] + 1
		a2 = a1 + n - 1
		rng.append([a1, a2])
q = int(input())
search = [int(i) for i in input().split()]
for i in search:
	print(binary_search(int(i), rng))


n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
my_list = []
for i in range(n):
	my_list += [i + 1] * a[i]
for i in q:
	print(my_list[i - 1])


import bisect
n = int(input())
l = [int(i) for i in input().split()]
m = int(input())
k = [int(i) for i in input().split()]
psa = []
s = 0
for i in range(len(l)):
	s += l[i]
	psa.append(s)
for i in k:
	t = bisect.bisect_left(psa, i)
	print(t + 1)


n = int(input())
a = [0] * 1000000
pos = 0
q = [int(s) for s in input().split()]
for i in range(n):
	l = q[i]
	for j in range(pos, l + pos):
		a[j] = i + 1
	pos = l + pos
w = int(input())
ww = [int(s) for s in input().split()]
for i in range(w):
	print(a[ww[i] - 1])


def binary(aim, start, end):
	mid = (start + end) // 2
	if a[mid] == aim:
		return mid
	if start >= end:
		return end
	if a[mid] > aim:
		return binary(aim, start, mid - 1)
	else:
		return binary(aim, mid + 1, end)
inp = lambda : [*map(int, input().split())]
n = int(input())
a = inp()
for i in range(1, n):
	a[i] += a[i - 1]
a = [0] + a + [10 ** 6 + 1]
m = int(input())
for i in inp():
	position = binary(i, 0, n + 1)
	if a[position - 1] < i <= a[position]:
		print(position)
		continue
	if a[position] < i <= a[position + 1]:
		print(position + 1)
		continue


n = int(input())
bunch = list(map(int, input().split()))
w = int(input())
worms = list(map(int, input().split()))
list = []
k = 1
for i in bunch:
	list += [k] * i
	k += 1
for i in worms:
	print(list[i - 1])


n = int(input())
l = list(map(int, input().split()))
m = int(input())
a = list(map(int, input().split()))
d = {i: 0 for i in a}
l1 = a
a = sorted(a)
for i in range(1, n):
	l[i] += l[i - 1]
(i, j) = (0, 0)
while j < m:
	if a[j] <= l[i]:
		d[a[j]] = i + 1
		j += 1
		continue
	i += 1
for i in l1:
	print(d[i])


n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
res = []
for i in range(n):
	res += [i] * a[i]
for x in b:
	print(res[x - 1] + 1)


def binary(arr, ele):
	l = 0
	r = len(arr)
	curr = (l + r) // 2
	while True:
		if arr[curr][0] <= ele <= arr[curr][1]:
			return curr + 1
		else:
			if arr[curr][1] > ele:
				r = curr
			else:
				l = curr
			curr = (l + r) // 2
n = int(input().strip())
arr = list(map(int, input().strip().split()))
m = int(input().strip())
b = list(map(int, input().strip().split()))
ranges = [(1, arr[0])]
for i in range(1, n):
	ranges.append((ranges[i - 1][1] + 1, ranges[i - 1][1] + arr[i]))
for i in b:
	print(binary(ranges, i))


n = int(input())
arr = list(map(int, input().split()))
q = int(input())
qrs = list(map(int, input().split()))
for i in range(1, len(arr)):
	arr[i] = arr[i] + arr[i - 1]
for qr in qrs:
	left = 0
	right = len(arr) - 1
	while left <= right:
		mid = (left + right) // 2
		if arr[mid] == qr or left == right == mid:
			print(mid + 1)
			break
		elif arr[mid] < qr:
			left = mid + 1
		else:
			right = mid


n = int(input())
A = list(map(int, input().split()))
m = int(input())
Q = list(map(int, input().split()))
s = sum(A)
T = [0 for _ in range(s)]
c = 0
for i in range(n):
	for j in range(A[i]):
		T[c] = i + 1
		c += 1
for i in range(m):
	print(T[Q[i] - 1])


from sys import stdin
from bisect import bisect_left
n = int(input())
l = list(map(int, stdin.readline().split()))
m = int(input())
q = list(map(int, stdin.readline().split()))
c = 0
l1 = []
for i in l:
	c += i
	l1.append(c)
for i in q:
	print(bisect_left(l1, i) + 1)


def binarysearch(a, x):
	lo = 0
	hi = len(z) - 1
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] == x:
			return mid + 1
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo + 1
n = int(input())
x = [int(i) for i in input().split()]
z = []
z.append(x[0])
for i in range(1, n):
	z.append(x[i] + z[i - 1])
a = int(input())
for i in input().split():
	i = int(i)
	print(binarysearch(z, i))


from sys import stdin, stdout
n = int(stdin.readline())
a = [int(i) for i in stdin.readline().split()]
ch = [a[0]]
for i in range(1, n):
	ch.append(a[i] + ch[i - 1])
m = int(stdin.readline())
b = map(int, stdin.readline().split())
mid = l = r = 0
for x in b:
	l = 0
	r = n
	while l != r - 1:
		mid = (l + r) // 2
		if ch[mid] > x:
			r = mid
		else:
			l = mid
	if ch[r - 1] < x:
		r += 1
	stdout.write(str(r) + '\n')


x = int(input())
s = list(map(int, input().split()))
z = []
l = 1
for n in s:
	z += [l] * n
	l += 1
input()
d = list(map(int, input().split()))
for n in d:
	print(z[n - 1])


(n, a, m, q) = (int(input()), list(map(int, input().split())), int(input()), list(map(int, input().split())))
(l, f, j) = ([0], [], 0)
for i in range(n):
	l.append(l[i] + a[i])
for i in range(pow(10, 6)):
	if j == len(l):
		break
	if l[j] == i:
		j += 1
	f.append(j)
for i in q:
	print(f[i - 1])


n = input('')
a = list(map(int, input('').split()))
m = int(input(''))
q = list(map(int, input('').split()))
worm_dict = dict()
total = 0
pileId = 0
for i in range(max(q) + 1):
	if i > total:
		total += a[pileId]
		pileId += 1
	d = {i: pileId}
	worm_dict.update(d)
for label in q:
	print(worm_dict[label])


from bisect import bisect_left
n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
for k in range(n - 1):
	a[k + 1] += a[k]
for l in q:
	print(bisect_left(a, l) + 1)


def BinSearch(L, N, start, end):
	mid = (start + end) // 2
	if end - start <= 1:
		if L[start] >= N:
			return start
		else:
			return end
	elif L[mid] >= N and L[mid - 1] < N:
		return mid
	elif L[mid] > N:
		return BinSearch(L, N, start, mid - 1)
	else:
		return BinSearch(L, N, mid + 1, end)
n = int(input())
L = [0] * (n + 1)
N = list(map(int, input().split()))
for i in range(1, n + 1):
	L[i] = L[i - 1] + N[i - 1]
M = int(input())
K = list(map(int, input().split()))
for i in range(M):
	print(BinSearch(L, K[i], 0, n))


import bisect
n = int(input())
a = [int(i) for i in input().split()]
pref = [0] * (n + 1)
for i in range(1, n + 1):
	pref[i] = pref[i - 1] + a[i - 1]
m = int(input())
b = [int(i) for i in input().split()]
for i in range(m):
	now = b[i]
	index = bisect.bisect_left(pref, now)
	print(index)


m = int(input())
m1 = list(map(int, input().split()))
n = int(input())
n1 = list(map(int, input().split()))
l = []
k = 0
for val in m1:
	k += 1
	for i in range(val):
		l.append(k)
for worms in n1:
	print(l[worms - 1])


from sys import stdin

def main():
	arr = []
	cnte = 1
	cnte2 = 1
	arr.append(int(0))
	stdin.readline()
	for i in map(int, stdin.readline().split()):
		for j in range(0, i):
			arr.append(cnte2)
		cnte2 = cnte2 + 1
	stdin.readline()
	for i in map(int, stdin.readline().split()):
		print(arr[i], '\n')
main()


n = int(input())
a = list(map(int, input().split()))
p = [(1, a[0])]
for i in range(1, n):
	t = p[i - 1]
	p.append((t[1] + 1, t[1] + a[i]))

def f(p, key, n, l, h, m):
	if p[m][0] <= key <= p[m][1]:
		return (m, l, h)
	while l <= h:
		m = (l + h) // 2
		if p[m][0] <= key <= p[m][1]:
			return (m, l, h)
		elif key > p[m][1]:
			l = m + 1
		else:
			h = m - 1
m = int(input())
b = list(map(int, input().split()))
l = 0
h = n
q = sorted(b)
d = {}
m = (l + h) // 2
for i in q:
	(m, l, h) = f(p, i, n, l, n, m)
	d[i] = m + 1
for i in b:
	print(d[i])


import bisect
N = int(input())
A = list(map(int, input().split()))
M = int(input())
Q = list(map(int, input().split()))
now = 0
R = []
for a in A:
	right = now + a
	R.append(right)
	now = right
for q in Q:
	ind = bisect.bisect_left(R, q)
	print(ind + 1)


from sys import stdin
from _bisect import bisect_left

def main():
	stdin.readline()
	(x, a) = (0, [])
	for y in map(int, stdin.readline().split()):
		x += y
		a.append(x)
	stdin.readline()
	for x in map(int, stdin.readline().split()):
		print(bisect_left(a, x) + 1)
main()


from bisect import bisect_left, bisect
n = int(input())
b = list(map(int, input().split()))
s = 0
t = []
for i in b:
	s += i
	t.append(s)
input()
for j in map(int, input().split()):
	print(bisect_left(t, j) + 1)


def read():
	input()
	sizes = list(map(int, input().split()))
	input()
	queries = list(map(int, input().split()))
	return (sizes, queries)

def calc_indexes(sizes):
	start_indexes = [1]
	for i in range(len(sizes)):
		start_indexes.append(start_indexes[i] + sizes[i])
	return start_indexes

def bin_search(ar, query):
	begin = 0
	end = len(ar)
	while end - begin > 1:
		middle = (end + begin) // 2
		if query < ar[middle]:
			end = middle
		else:
			begin = middle
	return begin
(sizes, queries) = read()
start_indexes = calc_indexes(sizes)
for q in queries:
	print(bin_search(start_indexes, q) + 1)


import bisect
n = int(input())
arr = list(map(int, input().split()))
q = int(input())
arr2 = list(map(int, input().split()))
for i in range(1, n):
	arr[i] += arr[i - 1]
for i in arr2:
	print(bisect.bisect_left(arr, i) + 1)


from bisect import bisect_left

def ans(a, b, n, m):
	ans = []
	px = [a[0]]
	for i in range(1, n):
		px.append(a[i] + px[i - 1])
	for i in range(m):
		pos = bisect_left(px, b[i])
		print(pos + 1)
n = int(input())
a = [int(i) for i in input().split()]
m = int(input())
b = [int(i) for i in input().split()]
ans(a, b, n, m)


n = int(input())
num = list(map(int, input().split()))
m = int(input())
ju = list(map(int, input().split()))
li = [0] * (10 ** 6 + 1)
s = 1
for i in range(n):
	li[s:s + num[i]] = [i + 1] * num[i]
	s += num[i]
for i in range(len(ju)):
	print(li[ju[i]])


import bisect as bs
n = int(input())
A = list(map(int, input().split()))
m = int(input())
B = list(map(int, input().split()))
S = [0]
for a in A:
	S.append(S[-1] + a)
for b in B:
	print(bs.bisect_left(S, b))


import sys
import bisect
n = int(input())
a = []
sum = 0
line = sys.stdin.readline().split()
for j in line:
	sum += int(j)
	a.append(sum)
m = int(input())
qq = map(int, sys.stdin.readline().split())
for q in qq:
	i = bisect.bisect_left(a, q)
	print(i + 1)


n = int(input())
a = [int(x) for x in input().split()]
m = int(input())
q = [int(x) for x in input().split()]
for i in range(1, n):
	a[i] += a[i - 1]
for num in q:
	(l, r) = (0, n - 1)
	while l <= r:
		mid = (l + r) // 2
		if a[mid] < num:
			l = mid + 1
		else:
			r = mid - 1
	print(l + 1)


n = int(input())
a = [int(i) for i in input().split()]
b = []
cnt = 1
for i in range(n):
	for j in range(a[i]):
		b.append(cnt)
	cnt += 1
m = int(input())
q = [int(i) for i in input().split()]
for i in q:
	print(b[i - 1])


n = int(input())
piles = list(map(int, input().split(' ')))
m = int(input())
worms = list(map(int, input().split(' ')))
new_list = []
grp = 0
for x in piles:
	grp += 1
	for i in range(x):
		new_list.append(grp)
for m in worms:
	print(new_list[m - 1])


n = int(input())
lin = list(map(int, input().split()))
mw = {}
pile = 1
wty = 0
for i in lin:
	j = i
	while j:
		wty += 1
		mw[wty] = pile
		j -= 1
	pile += 1
m = int(input())
lim = list(map(int, input().split()))
for i in lim:
	print(mw[i])


from bisect import bisect_left
n = int(input())
a = list(map(int, input().split()))
_ = input()
q = map(int, input().split())
for i in range(1, n):
	a[i] += a[i - 1]
for qi in q:
	print(bisect_left(a, qi) + 1)


from sys import stdin
import bisect
n = int(stdin.readline().rstrip())
l = list(map(int, stdin.readline().split()))
m = int(stdin.readline().rstrip())
k = list(map(int, stdin.readline().split()))
p = [0]
s = 0
for i in l:
	s += i
	p.append(s)
for i in k:
	t = bisect.bisect_left(p, i)
	print(t)


def BS(lis, n):
	st = 0
	en = len(lis) - 1
	while st < en:
		mid = (st + en) // 2
		if lis[mid] >= n:
			en = mid
		else:
			st = mid + 1
	return st
n = int(input())
lis = []
temp = input().split()
for i in temp:
	lis.append(int(i))
for i in range(1, n):
	lis[i] += lis[i - 1]
q = int(input())
temp = input().split()
lisQ = []
for i in temp:
	lisQ.append(int(i))
for i in lisQ:
	print(BS(lis, i) + 1)


n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
a = [1] + a
for i in range(1, n + 1):
	a[i] += a[i - 1]
P = a[-1] * [0]
for i in range(n):
	for j in range(a[i], a[i + 1]):
		P[j - 1] = i + 1
for i in range(m):
	print(P[q[i] - 1])


def Worm(l, p):
	tmp = 0
	d = p[:]
	ranges = []
	result = {}
	for i in range(len(l)):
		ranges.append((tmp + 1, int(l[i]) + tmp))
		tmp = int(l[i]) + tmp
	p.sort()
	tmp = 0
	for x in p:
		while 1:
			if ranges[tmp][0] <= int(x) and ranges[tmp][1] >= int(x):
				result[x] = tmp + 1
				break
			else:
				tmp += 1
	for x in d:
		print(result[x])
input()
l = input().split()
input()
p = [int(x) for x in input().split()]
Worm(l, p)


import sys
input = sys.stdin.buffer.readline
t = int(input())
arr = list(map(int, input().split()))
ans = []
c = 0
for x in arr:
	c += x
	ans.append(c)
n = int(input())
arr2 = list(map(int, input().split()))
for x in arr2:
	l = 0
	u = t - 1
	z = 0
	while l <= u:
		mid = (l + u) // 2
		if ans[mid] == x:
			print(mid + 1)
			break
		elif ans[mid] < x:
			l = mid + 1
		elif mid == 0:
			print('1')
			break
		elif ans[mid - 1] < x:
			print(mid + 1)
			break
		else:
			u = mid


a = int(input())
b = input().split()
c = int(input())
d = input().split()
b = [int(i) for i in b]
e = []
k = 0
for i in b:
	e.append(i + k)
	k = k + i
index = 1
j = 0
m = 1
f = [0]
while 1:
	if j == len(b):
		break
	if index == e[j] + 1:
		j = j + 1
		m = m + 1
	f.append(m)
	index = index + 1
for i in d:
	print(f[int(i)])


import bisect
n = int(input())
l = list(map(int, input().split()))
t = int(input())
for i in range(1, n):
	l[i] = l[i - 1] + l[i]
x = list(map(int, input().split()))
for i in x:
	print(bisect.bisect_left(l, i) + 1)


input()
piles = [int(x) for x in input().split()]
cumulated_piles = [0]
for x in piles:
	cumulated_piles.append(x + cumulated_piles[-1])
n = int(input())
placeholder_juicy = [0] * n
juicy = sorted([(i, int(x)) for (i, x) in enumerate(input().split())], key=lambda x: x[1])
c = 0
for (i, x) in enumerate(cumulated_piles):
	while c < n and juicy[c][1] <= x:
		placeholder_juicy[juicy[c][0]] = i
		c += 1
print('\n'.join((str(x) for x in placeholder_juicy)))


n = int(input())
piles = [int(x) for x in input().split()]
worms = int(input())
labels = [int(x) for x in input().split()]
L = []
k = 1
for x in range(len(piles)):
	L.extend([k] * piles[x])
	k += 1
for l in labels:
	print(L[l - 1])


import operator
n = int(input())
piles = [int(x) for x in input().split(' ')]
m = int(input())
goodWorms = [int(x) for x in input().split(' ')]
sortedWorms = sorted(goodWorms)
wormDict = {}
pileSeries = []
currentSum = 0
previousSum = 0
for i in piles:
	currentSum += i
	pileSeries.append((previousSum, currentSum))
	previousSum = currentSum
pile = 1
i = 0
output = []
pileCounter = 0
wormCounter = 0
while pileCounter < len(pileSeries) and wormCounter < len(sortedWorms):
	if pileSeries[pileCounter][0] < sortedWorms[wormCounter] <= pileSeries[pileCounter][1]:
		wormDict[sortedWorms[wormCounter]] = pileCounter + 1
		wormCounter += 1
	else:
		pileCounter += 1
for i in goodWorms:
	print(wormDict[i])


def binsearch(a, m):
	low = 0
	high = len(a) - 1
	while low < high:
		mid = (low + high) // 2
		if a[mid] < m:
			if low != mid:
				low = mid
			else:
				return high
		elif a[mid] > m:
			high = mid
		elif a[mid] == m:
			return mid
	return high
n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
for i in range(1, n):
	a[i] = a[i - 1] + a[i]
for i in range(m):
	idx = binsearch(a, q[i])
	print(idx + 1)


t = input
p = print
r = range
(n, a) = (int(t()), list(map(int, t().split())))
(m, b) = (int(t()), list(map(int, t().split())))
f = [0]
for i in range(n):
	f += [i + 1] * a[i]
for x in b:
	p(f[x])


n = int(input())
p = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))
k = 0
for x in range(len(p)):
	p[x] += k
	k = p[x]
for key in t:
	beg = -1
	end = len(p)
	if end - beg < 4:
		for l in range(beg, end + 1):
			if l >= 1:
				if key <= p[l] and key > p[l - 1]:
					print(l + 1)
			elif key <= p[l]:
				print(l)
	else:
		while end > beg + 1:
			middle = (end + beg) // 2
			if p[middle] >= key:
				end = middle
			else:
				beg = middle
	print(end + 1)


def func(x, k):
	l = 0
	r = len(x)
	while l <= r:
		m = int((l + r) / 2)
		if k == x[m]:
			return m + 1
		elif k > x[m]:
			l = m + 1
		else:
			r = m - 1
	return l + 1
n = int(input())
a = list(map(int, input().split(' ')))
m = int(input())
q = list(map(int, input().split(' ')))
x = []
sum = 0
for i in range(0, n):
	sum += a[i]
	x.append(sum)
for i in range(0, m):
	if q[i] <= x[0]:
		print(1)
		continue
	elif q[i] > x[n - 2]:
		print(n)
		continue
	print(func(x, q[i]))


from sys import stdin, exit
n = int(stdin.readline().rstrip())
piles = list(map(int, stdin.readline().rstrip().split(' ')))
m = int(stdin.readline().rstrip())
labels = list(map(int, stdin.readline().rstrip().split(' ')))
cur = 1
ranges = []
for pile in piles:
	ranges.append((cur, cur + pile - 1))
	cur += pile
for label in labels:
	l = 0
	r = n - 1
	while l <= r:
		m = (l + r) // 2
		(low, high) = ranges[m]
		if label < low:
			r = m - 1
		elif label > high:
			l = m + 1
		else:
			print(m + 1)
			break


def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] <= key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def main():
	n = int(input())
	a = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	d = []
	c = 0
	for i in range(n):
		d.append(c + 1)
		c = c + a[i]
		d.append(c)
	for i in range(m):
		if q[i] == d[len(d) - 1]:
			print(len(d) // 2)
		else:
			print((binarySearchCount(d, len(d), q[i]) + 1) // 2)
main()


import atexit
import io
import sys
import bisect
_I_B = sys.stdin.read().splitlines()
input = iter(_I_B).__next__
_O_B = io.StringIO()
sys.stdout = _O_B

@atexit.register
def write():
	sys.__stdout__.write(_O_B.getvalue())

def main():
	dp = dict()
	n = int(input())
	a = list(map(int, input().split()))
	for i in range(1, n):
		a[i] += a[i - 1]
	a = [0] + a
	m = int(input())
	q = list(map(int, input().split()))
	for i in q:
		try:
			print(dp[i])
		except KeyError:
			dp[i] = bisect.bisect_left(a, i)
			print(dp[i])
main()


import math
import random
import itertools
import collections
import sys
import time
import fractions
import os
import functools
import bisect

def timer(f):

	def tmp(*args, **kwargs):
		t = time.time()
		res = f(*args, **kwargs)
		print('Время выполнения функции: %f' % (time.time() - t))
		return res
	return tmp

def contains(l, elem):
	index = bisect.bisect_left(l, elem)
	if index < len(l):
		return l[index] == elem
	return False
n = int(input())
l = list(map(int, input().split(' ')))
q = int(input())
qs = list(map(int, input().split(' ')))
partials = list(itertools.accumulate(l))
for i in range(q):
	kuchka = bisect.bisect_left(partials, qs[i])
	print(kuchka + 1)


import sys
input = sys.stdin.readline

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0, hi=None):
	if hi == None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

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

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
from itertools import permutations
import math
from bisect import bisect_left

def solve():
	n = int(input())
	a = list(map(int, input().split()))
	m = int(input())
	b = list(map(int, input().split()))
	ps = [0]
	for x in a:
		ps.append(ps[-1] + x)
	for x in b:
		print(bisect_left(ps, x))
for _ in range(1):
	solve()


from sys import stdin

def main():
	inp = stdin
	n = int(inp.readline())
	worms = list(map(int, inp.readline().split()))
	J = int(inp.readline())
	Jworms = list(map(int, inp.readline().split()))
	lunch = list()
	for i in range(0, len(worms)):
		lunch += [i + 1] * worms[i]
	for i in Jworms:
		print(lunch[i - 1])
main()


from itertools import accumulate
from bisect import bisect_left
n = int(input())
worms = list(map(int, input().split()))
array = [0] + list(accumulate(worms))
input()
queries = list(map(int, input().split()))
for target in queries:
	print(bisect_left(array, target))


from bisect import bisect_right
from bisect import bisect_left
n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(0, n):
	b.append(0)
	b[i] = b[i - 1] + a[i]
k = int(input())
q = list(map(int, input().split()))
for x in q:
	print(bisect_left(b, x) + 1)


import bisect
input()
a = [0]
for x in map(int, input().split()):
	a.append(a[-1] + x)
input()
for x in map(int, input().split()):
	print(bisect.bisect_left(a, x))


num = int(input())
piles = list(map(int, input().split(' ')))
tuplex = []
curr = 1
for i in piles:
	tuplex.append((curr, curr + i - 1))
	curr = curr + i
quer = int(input())
queries = list(map(int, input().split(' ')))
quer2 = [[queries[x], x, -1] for x in range(len(queries))]
quer2.sort(key=lambda x: x[0])
ind = 0
for i in range(len(quer2)):
	while not tuplex[ind][0] <= quer2[i][0] <= tuplex[ind][1]:
		ind += 1
	quer2[i][2] = ind
quer2.sort(key=lambda x: x[1])
for i in quer2:
	print(i[2] + 1)


def binarySearch(arr, l, r, x):
	if r >= l:
		mid = l + (r - l) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] > x:
			return binarySearch(arr, l, mid - 1, x)
		else:
			return binarySearch(arr, mid + 1, r, x)
	else:
		return r + 1
n = int(input())
l1 = list(map(int, input().split()))
m = int(input())
l2 = list(map(int, input().split()))
prefixsum = [0] * n
p = 0
for i in range(n):
	p += l1[i]
	prefixsum[i] = p
for i in range(m):
	x = binarySearch(prefixsum, 0, n - 1, l2[i])
	print(int(x) + 1)


n = int(input())
a = [int(p) for p in input().split()]
m = int(input())
l = [int(q) for q in input().split()]
d = []
k = 0
for i in range(n):
	d += [i + 1] * a[i]
for i in range(m):
	print(d[l[i] - 1])


n = int(input())
a = [int(aux) for aux in input().split()]
a = [0] + a
for i in range(2, n + 1):
	a[i] += a[i - 1]
m = int(input())
queries = [int(aux) for aux in input().split()]
for i in range(0, m):
	q = queries[i]
	l = 1
	r = n
	while l <= r:
		mid = (l + r) // 2
		if a[mid] >= q:
			r = mid - 1
		else:
			l = mid + 1
	print(l)


n = int(input())
p = {}
pn = 1
for (i, n) in enumerate(input().split()):
	n = int(n)
	for ni in range(pn, pn + n):
		p[ni] = i + 1
	pn = pn + n
j = int(input())
for jw in input().split():
	jw = int(jw)
	print(p[jw])


n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
for i in range(1, n):
	a[i] += a[i - 1]
for j in q:
	l = 0
	u = n
	p = 10 ** 7
	while l <= u:
		mid = (l + u) // 2
		if a[mid] >= j:
			p = min(mid, p)
			u = mid - 1
		else:
			l = mid + 1
	print(p + 1)


from sys import stdin
from bisect import bisect_left
stdin.readline()
(x, l) = (0, [])
for y in map(int, stdin.readline().split()):
	x += y
	l.append(x)
stdin.readline()
for y in map(int, stdin.readline().split()):
	print(bisect_left(l, y) + 1)


import bisect
arrSize = int(input())
arr = list(map(int, input().split()))
sum = 0
prefix_array = []
for i in arr:
	sum += i
	prefix_array.append(sum)
quries = int(input())
que = list(map(int, input().split()))
for i in que:
	print(bisect.bisect_right(prefix_array, i - 1) + 1)


n = int(input())
a = [int(i) for i in input().split()]
t = list()
p = 1
for i in a:
	t.extend([p] * i)
	p += 1
m = int(input())
q = [int(i) for i in input().split()]
for i in q:
	print(t[i - 1])


(n, a, m, b, e) = (input(), [int(i) for i in input().split()], input(), [int(i) for i in input().split()], [])
for i in range(len(a)):
	for j in range(a[i]):
		e.append(i + 1)
for i in b:
	print(e[i - 1])


import bisect
n = int(input())
a = map(int, input().split())
b = [1]
for x in a:
	b.append(b[-1] + x)
m = int(input())
c = map(int, input().split())
for x in c:
	print(bisect.bisect(b, x))


import math
n = int(input())
a = [int(x) for x in input().split()]
m = int(input())
q = [int(x) for x in input().split()]
label = [0]
for i in a:
	label.append(label[-1] + i)
for i in q:
	low = 0
	high = n
	while True:
		mid = math.floor((low + high) / 2)
		if i > label[mid - 1] and i <= label[mid]:
			print(mid)
			break
		elif i > label[mid]:
			low = mid + 1
		else:
			high = mid - 1


__author__ = 'Rajan'
n = int(input())
pre = [0 for i in range(1000000 + 10)]
mp = map(int, input().split())
j = 0
index = 1
for k in mp:
	for i in range(j + 1, j + k + 1):
		pre[i] = index
	index += 1
	j += k
m = int(input())
mp = map(int, input().split())
for k in mp:
	print(pre[k])


__author__ = 'hamed1soleimani'
import math
input()
p = input().split()
input()
q = input().split()
worms = list(range(10 ** 6))
m = 0
for i in range(len(p)):
	for j in range(int(p[i])):
		worms[m] = i
		m += 1
for x in q:
	print(worms[int(x) - 1] + 1)


from bisect import bisect_left
n = int(input())
arr = list(map(int, input().split()))
prefix_sum = [0]
for i in arr:
	prefix_sum.append(prefix_sum[-1] + i)
q = int(input())
for i in map(int, input().split()):
	pos = bisect_left(prefix_sum, i)
	print(pos)


from bisect import bisect_left
from sys import stdin, stdout
n = int(stdin.readline())
a = list(map(int, stdin.readline().split(' ')))
for i in range(1, len(a)):
	a[i] += a[i - 1]
m = int(stdin.readline())
qs = list(map(int, stdin.readline().split(' ')))
for q in qs:
	stdout.write(str(bisect_left(a, q) + 1) + '\n')


n = int(input())
ls = []
zzh = []
zzh.append(0)
ls = [int(u) for u in input().split()]
for item in range(len(ls)):
	for _ in range(ls[item]):
		zzh.append(item + 1)
m = int(input())
inp = [int(u) for u in input().split()]
for u in inp:
	print(zzh[u])


from bisect import bisect_left
a = int(input())
b = list(map(int, input().split()))
c = input()
d = list(map(int, input().split()))
temp = [1, b[0]]
for i in range(1, a):
	temp.append(temp[len(temp) - 1] + 1)
	temp.append(temp[len(temp) - 1] + b[i] - 1)
upperBound = []
for i in range(1, len(temp), 2):
	upperBound.append(temp[i])
hold = upperBound
for i in d:
	print(bisect_left(hold, i) + 1)


def bsearch(arr, n):
	l = 0
	r = len(arr) - 1
	while l <= r:
		mid = (l + r) // 2
		if arr[mid] >= n and arr[mid - 1] < n:
			return mid + 1
		elif arr[mid] < n:
			l = mid + 1
		else:
			r = mid - 1
	if mid == 0:
		return 1
	else:
		return len(arr)
n = int(input())
wrms = [int(x) for x in input().split()]
m = int(input())
pos = [int(x) for x in input().split()]
sm = 0
cumu = []
for i in range(len(wrms)):
	sm += wrms[i]
	cumu.append(sm)
for ele in pos:
	print(bsearch(cumu, ele))


def BS(A, x, l, h):
	if h >= l:
		m = (l + h) // 2
		if A[m - 1] < x <= A[m]:
			return m
		elif x < A[m]:
			return BS(A, x, l, m)
		elif x > A[m]:
			return BS(A, x, m, h)
	return 1
n = int(input())
A = list(map(int, input().split()))
m = int(input())
B = list(map(int, input().split()))
s = 0
C = []
for i in range(n):
	C.append(s)
	s = s + A[i]
C.append(s)
for i in B:
	print(BS(C, i, 1, n + 1))


d = dict()
acc = 0
a__i = -1
n = int(input())
l = [int(x) for x in input().split()]
for i in range(1, sum(l) + 1):
	if acc >= i:
		d[i] = a__i
	else:
		acc += l[a__i + 1]
		a__i += 1
		d[i] = a__i
n2 = int(input())
l1 = (int(x) for x in input().split())
for x in range(n2):
	print(d[next(l1)] + 1)


n = int(input())
ai = list(map(int, input().split()))
for i in range(1, n):
	ai[i] = ai[i] + ai[i - 1]
pile = [1] * ai[-1]
num = 2
for i in range(1, n):
	for j in range(ai[i - 1], ai[i]):
		pile[j] = num
	num = num + 1
m = int(input())
qi = input().split()
for k in qi:
	print(pile[int(k) - 1])


n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
q1 = sorted([(q[i], i) for i in range(m)])
s = 0
inx = 0
for i in q1:
	while s + a[inx] < i[0]:
		s += a[inx]
		inx += 1
	q[i[1]] = inx + 1
for i in q:
	print(i)


n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
sums = [a[0]]
for x in range(1, n):
	sums.append(sums[-1] + a[x])
sq = sorted(q)
d = dict()
start = 0
for y in sq:
	for x in range(start, n - 1):
		if sums[x] >= y:
			d[y] = x + 1
			start = x
			break
		elif sums[x] < y <= sums[x + 1]:
			d[y] = x + 2
			start = x
			break
for aaa in q:
	print(d[aaa])


def func(query, low, high):
	mid = (low + high) // 2
	if query <= num_rooms[mid] and query > num_rooms[mid - 1]:
		return mid
	elif query > num_rooms[mid] and query <= num_rooms[mid + 1]:
		return mid + 1
	elif query < num_rooms[mid]:
		return func(query, low, mid)
	elif query > num_rooms[mid]:
		return func(query, mid, high)
n = int(input())
num_rooms = list(map(int, input().split()))
num_rooms.insert(0, 0)
for i in range(n + 1):
	if i > 0:
		num_rooms[i] += num_rooms[i - 1]
q = int(input())
query_store = list(map(int, input().split()))
ans_store = []
for query in query_store:
	ans_store.append(func(query, 1, n))
for m in range(q):
	print(ans_store[m])


from bisect import bisect
input()
a = list(map(int, input().split()))
input()
b = list(map(int, input().split()))
a1 = [1]
ans = ''
for item in a:
	a1.append(a1[-1] + item)
for item in b:
	ans += f'{bisect(a1, item)}\n'
print(ans)


import sys
from itertools import accumulate

def write_to_stdout(res):
	sys.stdout.write('%s\n' % '\n'.join(res))

def read_input():
	n = int(input())
	worms = [int(_) for _ in input().rstrip().split()]
	temp = input()
	idxes = [int(_) for _ in input().rstrip().split()]
	return (worms, idxes)

def get_idx(number, worms_cumul, start, end):
	while start <= end:
		index = (end + start) // 2
		current_value = worms_cumul[index]
		if current_value == number or start == end:
			return index + 1
		elif current_value > number:
			end = index
		else:
			start = index + 1
	return end + 1

def get_idx2(number, worms_cumul, start, end):
	for (idx, num) in enumerate(worms_cumul):
		if num >= number:
			return idx + 1
	return 0

def get_answer(worms, numbers):
	worms_cumul = list(accumulate(worms))
	ans = []
	for n in numbers:
		idx = get_idx(n, worms_cumul, 0, len(worms_cumul) - 1)
		ans.append(str(idx))
	return ans

def main():
	(worms, idxes) = read_input()
	answer = get_answer(worms, idxes)
	write_to_stdout(answer)
main()


a = int(input())
l = list(map(int, input().split()))
r = 1
m = []
for i in l:
	m += [r] * i
	r += 1
b = int(input())
n = list(map(int, input().split()))
for i in n:
	print(m[i - 1])


from sys import stdin
max_val = int(10000000000000.0)
min_val = int(-10000000000000.0)

def read_int():
	return int(stdin.readline())

def read_ints():
	return [int(x) for x in stdin.readline().split()]

def read_str():
	return input()

def read_strs():
	return [x for x in stdin.readline().split()]
nb_piles = read_int()
piles = read_ints()
nb_query = read_int()
query = read_ints()
groups = []
for i in range(nb_piles):
	groups += [i + 1] * piles[i]
for i in query:
	print(groups[i - 1])


def ceil(a, k):
	l = 0
	h = len(a) - 1
	while l < h:
		mid = l + (h - l) // 2
		if a[mid] >= k:
			h = mid
		else:
			l = mid + 1
	return l + 1
n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
sum = 0
for i in range(n):
	sum += a[i]
	a[i] = sum
for i in b:
	print(ceil(a, i))


def BinarySearch(alist, item):
	low = 0
	high = len(alist)
	while low < high:
		mid = (high + low) // 2
		if alist[mid] < item:
			low = mid + 1
		else:
			high = mid
	return low
input()
poles = list(map(int, input().split()))
input()
juicy = list(map(int, input().split()))
sm = 0
worms = []
for i in poles:
	sm += i
	worms.append(sm)
for i in juicy:
	res = BinarySearch(worms, i)
	print(res + 1)


n = int(input())
worms = [int(x) for x in input().split()]
wowo = [0]
for (i, x) in enumerate(worms, 1):
	wowo.extend([i] * x)
input()
for q in input().split():
	print(wowo[int(q)])


from itertools import accumulate
import bisect
n = int(input())
piles = [int(i) for i in input().split()]
piles = list(accumulate(piles))
m = int(input())
worms = [int(i) for i in input().split()]
for worm in worms:
	print(bisect.bisect_left(piles, worm) + 1)


import os
import sys
from math 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 value():
	return map(int, input().split())

def array():
	return [int(i) for i in input().split()]

def bs(a, k):
	l = 0
	h = len(a) - 1
	while l <= h:
		m = l + (h - l) // 2
		if a[m] >= k and (m == 0 or a[m - 1] < k):
			return m
		elif k < a[m]:
			h = m - 1
		else:
			l = m + 1
	return len(a) - 1
n = int(input())
a = array()
su = [a[0]]
for i in range(1, n):
	su.append(su[i - 1] + a[i])
m = int(input())
for k in input().split():
	k = int(k)
	print(bs(su, k) + 1)


import math
import collections
import bisect
import heapq
import time
import random
import itertools
import sys
N = int(input())
A = [int(x) for x in input().split()]
M = int(input())
Q = [int(x) for x in input().split()]
left = [0] * (N + 1)
for i in range(1, N + 1):
	left[i] = left[i - 1] + A[i - 1]
for q in Q:
	m = bisect.bisect_left(left, q)
	print(m)


n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
temp = 0
for i in range(n):
	temp += a[i]
	a[i] = temp
b = [0] * (a[-1] + 1)
p1 = 0
for i in range(1, a[-1] + 1):
	if i > a[p1]:
		p1 += 1
	b[i] = p1 + 1
for i in q:
	print(b[i])


n = int(input())
a = [None for i in range(1000000)]
j = 0
h = 1
for i in list(map(int, input().split())):
	for _ in range(i):
		a[j] = h
		j += 1
	h += 1
input()
for i in list(map(int, input().split())):
	print(a[i - 1])


def bsearch(arr, el):
	start = 0
	end = len(arr) - 1
	while start <= end:
		mid = (start + end) // 2
		mid_el = arr[mid]
		if el < mid_el:
			end = mid - 1
		elif el > mid_el:
			start = mid + 1
		else:
			return mid + 1
	if arr[start] > el:
		return start + 1
	else:
		return end + 1
n = int(input())
arr = list(map(int, input().split()))
m = int(input())
to_search = list(map(int, input().split()))
sum_arr = [arr[0]]
for i in arr[1:]:
	sum_arr.append(sum_arr[-1] + i)
for i in to_search:
	print(bsearch(sum_arr, i))


n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
b = [0] * sum(a)
c = 0
for i in range(len(a)):
	b[c:c + a[i]] = [i] * a[i]
	c += a[i]
for i in q:
	print(b[i - 1] + 1)


n = int(input())
piles = [int(i) for i in input().split()]
worms = []
for i in range(n):
	worms.extend([i + 1] * piles[i])
m = int(input())
qs = [int(i) for i in input().split()]
for q in qs:
	print(worms[q - 1])


import bisect
n = int(input())
a = list(map(int, input().split()))[:n]
m = int(input())
q = list(map(int, input().split()))[:m]
level = [0] * n
for i in range(n):
	if i == 0:
		level[0] += a[0]
	else:
		level[i] = level[i - 1] + a[i]

def myBinSearch(arr, n):
	length = len(arr)
	start = 0
	end = length - 1
	if n < arr[0]:
		return 1
	while 1:
		if arr[(start + end) // 2] == n:
			return (start + end) // 2 + 1
		elif arr[(start + end) // 2] < n:
			if arr[(start + end) // 2 + 1] == n:
				return (start + end) // 2 + 1 + 1
			elif arr[(start + end) // 2 + 1] > n:
				return (start + end) // 2 + 1 + 1
			else:
				start = (start + end) // 2
		elif arr[(start + end) // 2] > n:
			if arr[(start + end) // 2 - 1] == n:
				return (start + end) // 2 - 1 + 1
			elif arr[(start + end) // 2 - 1] < n:
				return (start + end) // 2 + 1
			else:
				end = (start + end) // 2
for i in range(m):
	print(myBinSearch(level, q[i]))


def GetWorms(worms):
	w = [1]
	s = worms[0]
	for i in range(1, len(worms)):
		w.append(s + 1)
		s += worms[i]
	return w

def Solve(worms, label, maxx):
	low = 0
	high = len(worms) - 1
	while low <= high:
		mid = (low + high) // 2
		if label > worms[mid]:
			low = mid + 1
		elif label < worms[mid]:
			if mid > 0:
				if label > worms[mid - 1]:
					mid -= 1
					break
			high = mid - 1
		else:
			break
	return mid + 1

def main():
	n = int(input())
	worms = list(map(int, input().split()))
	m = int(input())
	labels = list(map(int, input().split()))
	s = sum(worms)
	worms = GetWorms(worms)
	for i in labels:
		print(Solve(worms, i, s))
main()


import bisect
n = int(input())
a = list(map(int, input().split()))
c = []
s = 0
for i in range(n):
	c.append(s + a[i])
	s = s + a[i]
m = int(input())
a = list(map(int, input().split()))
for i in range(len(a)):
	print(bisect.bisect_left(c, a[i]) + 1)


n = int(input())
a = [0]
a.extend(list(map(int, input().split())))
m = int(input())
q = list(map(int, input().split()))
t = a[0]
temp = [t]
for i in range(1, len(a)):
	t += a[i]
	temp.append(t)
t = [0] * (sum(a) + 1)
x = 1
for i in range(1, n + 1):
	for j in range(temp[i - 1], temp[i] + 1):
		t[j] = x
	x += 1
for item in q:
	print(t[item - 1])


n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
b = []
j = 1
for i in a:
	while i != 0:
		b.append(j)
		i -= 1
	j += 1
for i in q:
	print(b[i - 1])


n = input()
n = int(n)
pile = []
pile = input().rstrip().split(' ')
pile[0] = int(pile[0])
for i in range(1, n):
	pile[i] = int(pile[i - 1]) + int(pile[i])
m = input()
labels = []
labels = input().rstrip().split(' ')

def Binary_search(x):
	start = 0
	end = n - 1
	while start <= end:
		mid = int((start + end) / 2)
		if x > pile[mid]:
			start = mid + 1
		elif x <= pile[mid] and x > pile[mid - 1]:
			break
		else:
			end = mid - 1
	return mid + 1
for j in labels:
	print(Binary_search(int(j)))


n = int(input())
a = list(map(int, input().rsplit()))
m = int(input())
q = list(map(int, input().rsplit()))
b = []
a0 = 0
for i in range(n):
	j = a0 + 1
	while j <= a[i] + a0:
		b.append(i + 1)
		j += 1
	a0 = a[i]
for j in range(m):
	print(b[q[j] - 1])


import bisect
n = int(input())
worms_per_pile = [0] + list(map(int, input().strip().split()))
m = int(input())
queries = list(map(int, input().strip().split()))
accumulator = []
partial_sum = 0
for pile in worms_per_pile:
	partial_sum += pile
	accumulator.append(partial_sum)
for query in queries:
	print(bisect.bisect_left(accumulator, query))


n = int(input())
A = list(map(int, input().split()))
m = int(input())
B = list(map(int, input().split()))
C = [0]
for i in range(n):
	C.append(C[i] + A[i])
for j in range(len(B)):
	l = 0
	r = len(C)
	while r - l > 1:
		mid = (l + r) // 2
		if C[mid] >= B[j]:
			r = mid
		elif C[mid] <= B[j]:
			l = mid
	print(r)


import bisect
n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
for i in range(1, len(a)):
	a[i] += a[i - 1]
for i in q:
	c = bisect.bisect_left(a, i) + 1
	print(c)


n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
for i in range(1, n):
	a[i] = a[i] + a[i - 1]
l = max(q) + 1
j = 1
ll = [0] * l
for i in range(1, l):
	if i <= a[j - 1]:
		ll[i] = j
	else:
		j = j + 1
		ll[i] = j
for i in range(m):
	x = q[i]
	print(ll[x])


def binarySearch(a, q, start, end):
	mid = int(start + int((end - start) / 2))
	if a[mid] >= q and a[mid - 1] < q:
		return int(mid + 1)
	elif a[mid] > q:
		return int(binarySearch(a, q, start, mid))
	elif a[mid] < q:
		return int(binarySearch(a, q, mid + 1, end))

def main():
	n = int(input())
	a = [0] * n
	ip = [int(i) for i in input().split()]
	for i in range(n):
		a[i] = a[i - 1] + ip[i]
	m = int(input())
	q = [int(i) for i in input().split()]
	for i in range(m):
		if q[i] <= a[0]:
			print(1)
		elif q[i] > a[n - 2]:
			print(n)
		else:
			print(binarySearch(a, q[i], 0, n - 1))
main()


from bisect import bisect_left
n = int(input())
A = [int(i) for i in input().split()]
B = [A[0]]
for i in range(1, n):
	B.append(B[-1] + A[i])
t = int(input())
C = [int(i) for i in input().split()]
for i in C:
	print(bisect_left(B, i) + 1)


fi = lambda : map(int, input().split())
ii = lambda : int(input())
from itertools import accumulate
from bisect import bisect_left
n = ii()
a = list(accumulate(fi()))
m = ii()
for i in fi():
	print(bisect_left(a, i) + 1)


import bisect
n = int(input())
s = input().split(' ')
a = [0] * n
for x in range(n):
	a[x] = int(s[x])
d = []
c = 0
for x in range(n):
	d.append(c + a[x])
	c += a[x]
p = int(input())
s = input().split(' ')
m = [0] * p
for x in range(p):
	m[x] = int(s[x])
for x in range(p):
	mid = bisect.bisect_left(d, m[x]) + 1
	print(mid)


def binarySearch(nums, target):
	if len(nums) == 0:
		return -1
	(left, right) = (0, len(nums))
	while left < right:
		mid = left + (right - left) // 2
		if nums[mid] > target:
			right = mid
		else:
			left = mid + 1
	return left
n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
s = []
sum = 0
for i in range(n):
	sum += a[i]
	s.append(sum)
for i in range(n):
	s[i] += 1
for i in range(m):
	print(binarySearch(s, q[i]) + 1)


n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
suma = [a[0]]
i = 1
while i < n:
	suma.append(suma[i - 1] + a[i])
	i += 1
for item in q:
	high = n - 1
	low = 0
	mid = (high + low) // 2
	while True:
		if item > suma[mid]:
			low = mid + 1
			mid = (high + low) // 2
		elif item < suma[mid]:
			if mid == 0:
				break
			elif item > suma[mid - 1]:
				break
			else:
				high = mid - 1
				mid = (high + low) // 2
		else:
			break
	print(mid + 1)


n = int(input())
a = list(map(int, input().split()))
last = 0
for i in range(n):
	a[i] += last
	last = a[i]
m = int(input())
q = map(int, input().split())
for ch in q:
	l = 0
	r = n - 1
	middle = (l + r) // 2
	while l < r:
		if ch > a[middle]:
			l = middle + 1
		else:
			r = middle
		middle = (l + r) // 2
	print(middle + 1)


import bisect
n = input()
worms = [0]
for w in map(int, input().split()):
	worms.append(worms[-1] + w)
nq = input()
for q in map(int, input().split()):
	print(bisect.bisect_left(worms, q))


n = int(input())
piles = input().split(' ')
m = input()
asks = input().split(' ')
guia = 0
ant = 0
for pile in piles:
	piles[guia] = ant + int(piles[guia])
	ant = piles[guia]
	guia += 1
for ask in asks:
	curAsk = int(ask)
	piv1 = 0
	piv2 = n - 1
	while piv1 + 1 < piv2:
		midPoint = (piv1 + piv2) // 2
		if curAsk <= piles[midPoint]:
			piv2 = midPoint
		else:
			piv1 = midPoint
	if curAsk <= piles[piv1]:
		print(piv1 + 1)
	else:
		print(piv2 + 1)


import itertools
a = int(input())
aa = [int(i) for i in input().split()]
b = int(input())
bb = [int(i) for i in input().split()]
an = []
ans = 1
for i in aa:
	for j in range(i):
		an.append(ans)
	ans += 1
for i in bb:
	print(an[i - 1])


n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
qq = sorted(q)
ans = dict()
limit = 0
i = 0
for k in qq:
	while not limit < k <= limit + a[i]:
		limit += a[i]
		i += 1
	ans[k] = i + 1
for k in q:
	print(ans[k])


n = int(input())
h = list(map(int, input().split()))
a = []
for i in range(len(h)):
	a += [i for k in range(h[i])]
m = int(input())
h = list(map(int, input().split()))
for i in h:
	print(a[i - 1] + 1)


n = int(input())
sep = list(map(int, input().split()))
nums = int(input())
ip = map(int, input().split())
s = sum(sep)
l = [0] * s
(step, count) = (0, 1)
for i in sep:
	for k in range(step, step + i):
		l[k] = count
	step += i
	count += 1
for i in ip:
	print(l[i - 1])


n = int(input())
w = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
pre = [w[0]]
for i in range(1, n):
	pre.append(pre[i - 1] + w[i])
for i in q:
	left = 0
	right = n - 1
	ans = 0
	while left <= right:
		mid = left + (right - left) // 2
		if pre[mid] >= i:
			ans = mid
			right = mid - 1
		else:
			left = mid + 1
	print(ans + 1)


import os, sys
from io import BytesIO, IOBase
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))
try:
	(sys.stdin, sys.stdout) = (open('in.txt', 'r'), open('out.txt', 'w'))
except:
	pass
ii1 = lambda : int(sys.stdin.readline().strip())
is1 = lambda : sys.stdin.readline().strip()
iia = lambda : list(map(int, sys.stdin.readline().strip().split()))
isa = lambda : sys.stdin.readline().strip().split()
mod = int(1000000000.0 + 7)
from collections import *
from math import *
from collections import deque as dq
from bisect import bisect_left as bl
n = ii1()
arr = iia()
for i in range(1, n):
	arr[i] += arr[i - 1]
m = ii1()
query = iia()
for q in query:
	idx = bl(arr, q)
	print(idx + 1)


def I():
	return list(map(int, input().split()))
n = int(input())
x = I()
m = int(input())
q = I()
arr = [0] * (n + 1)
arr[0] = x[0]
for i in range(n - 1):
	arr[i + 1] = arr[i] + x[i + 1]
for i in range(m):
	l = 0
	r = n - 1
	while l <= r:
		mid = (r - l) // 2 + l
		if arr[mid] < q[i]:
			l = mid + 1
		else:
			r = mid - 1
	print(l + 1)


def borders(nums):
	prev = 1
	for x in nums:
		yield (prev, prev + x - 1)
		prev += x

def inside(x, first, last):
	return first <= x <= last
heapsamount = int(input())
nums = list((int(x) for x in input().split(' ')))
jamount = int(input())
j = list((int(x) for x in input().split(' ')))
b = list(borders(nums))
sor = list(([x, y, None] for (x, y) in zip(j, list(range(jamount)))))
sor.sort(key=lambda x: x[0])
i = 0
j = 0
for (number, index, n) in sor:
	bord = b[i]
	while not inside(number, bord[0], bord[1]):
		i += 1
		bord = b[i]
	sor[j][2] = i + 1
	j += 1
sor.sort(key=lambda x: x[1])
for x in sor:
	print(x[2])


n = int(input())
a = [int(x) for x in input().split()]
m = int(input())
am = [int(x) for x in input().split()]
lister = []
for (i, x) in enumerate(a):
	lister += [i + 1] * x
for i in am:
	print(lister[i - 1])


import bisect
my_list = []
new_list = []
find_list = []
num = int(input())
my_list = list(map(int, input().split()))
a = 1
new_list.append(my_list[0])
new_list.append(my_list[0] + a + (my_list[1] - 1))
for i in range(1, len(my_list) - 1, 1):
	k = i + 1
	new_list.append(new_list[i] + a + (my_list[k] - 1))
num = int(input())
find_list = list(map(int, input().split()))
for i in range(num):
	val = bisect.bisect(new_list, find_list[i])
	if find_list[i] == new_list[val - 1]:
		print(val)
	else:
		print(val + 1)


n = int(input())
a = input().split()
k = 1
c = []
for elim in a:
	for i in range(int(elim)):
		c.append(k)
	k += 1
m = int(input())
b = input().split()
for elim in b:
	print(c[int(elim) - 1])


n = int(input())
arr = list(map(int, input().split()))
m = int(input())
quarr = list(map(int, input().split()))
sumarr = [0 for i in range(n)]
sumarr[0] = arr[0]
for i in range(1, n):
	sumarr[i] = sumarr[i - 1] + arr[i]
for w in range(m):
	q = quarr[w]
	l = 0
	r = n - 1
	while l <= r:
		mid = (l + r) // 2
		if sumarr[mid] >= q:
			r = mid - 1
		else:
			l = mid + 1
	print(l + 1)


from bisect import bisect_left
a = int(input())
z = list(map(int, input().split()))
for i in range(1, len(z)):
	z[i] += z[i - 1]
r = int(input())
ma = list(map(int, input().split()))
for i in range(len(ma)):
	x = bisect_left(z, ma[i])
	print(x + 1)


n = int(input())
piles = [int(x) for x in input().split()]
w = int(input())
worms = [int(x) for x in input().split()]
d = {}
w = 1
for i in range(len(piles)):
	for j in range(piles[i]):
		d[w] = i
		w += 1
for w in worms:
	print(d[w] + 1)


n = int(input())
a = [1] + list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
for i in range(1, n + 1):
	a[i] += a[i - 1]
i = 0
d = dict.fromkeys(q, 0)
for el in sorted(d):
	while el >= a[i]:
		i += 1
	d[el] = i
res = []
for el in q:
	res += [str(d[el])]
print('\n'.join(res))


import bisect
n = int(input())
L = [int(i) for i in input().split()]
for i in range(0, n - 1):
	L[i + 1] += L[i]
x = int(input())
A = [int(i) for i in input().split()]
for i in A:
	print(bisect.bisect_left(L, i) + 1)


n = int(input())
arr = list(map(int, input().split()))
m = int(input())
jw = list(map(int, input().split()))
res = [0] * m
from itertools import accumulate
acc = list(accumulate(arr))
sorted_indices = sorted(range(m), key=lambda i: jw[i])
acc_indices = list(range(n))
i = j = 0
while i < m:
	val = jw[sorted_indices[i]]
	if acc_indices and val <= acc[acc_indices[j]]:
		res[sorted_indices[i]] = acc_indices[j] + 1
		i += 1
	else:
		j += 1
print('\n'.join(map(str, res)))


from bisect import bisect_left as bs
from math import log as lg
log = lambda *x: print(*x)

def cin(*fn, def_fn=str):
	(i, r) = (0, [])
	if fn:
		def_fn = fn[0]
	for c in input().split(' '):
		r += [(fn[i] if len(fn) > i else def_fn)(c)]
		i += 1
	return r
(n,) = cin(int)
a = cin(int)
(m,) = cin(int)
q = cin(int)
ra = [1]
for i in range(n - 1):
	ra += [ra[-1] + a[i]]
(c, loc) = (0, {1: 1})
for i in range(2, ra[-1] + 1):
	c += c != n - 1 and i >= ra[c + 1]
	loc[i] = c + 1
for i in q:
	log(loc.setdefault(i, n))


n = int(input())
worms = [0]
numbers = list(map(int, input().split()))
for number in numbers:
	worms.append(worms[-1] + number)
input()
query = list(map(int, input().split()))
sort = sorted(query)
Dictionary = dict()
queryind = 0
i = 0
while i < len(worms):
	if queryind == len(query):
		break
	if worms[i - 1] < sort[queryind] <= worms[i]:
		p = sort[queryind]
		Dictionary[p] = i
		queryind += 1
	else:
		i += 1
for queryy in query:
	print(Dictionary[queryy])


n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
(l, c) = (0, [0])
for i in range(n):
	l += a[i]
	c.append(l)
for i in range(m):
	(start, end) = (0, n)
	while start <= end:
		middle = (start + end) // 2
		if c[middle] == b[i]:
			print(middle)
			break
		if c[middle] > b[i]:
			if c[middle - 1] < b[i]:
				print(middle)
				break
			else:
				end = middle - 1
		if c[middle] < b[i]:
			if c[middle + 1] > b[i]:
				print(middle + 1)
				break
			else:
				start = middle + 1


n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
l = []
l.append(a[0])
for i in range(1, n):
	l.append(l[i - 1] + a[i])
s = 0
ans = 0
r = n - 1
for i in b:
	s = 0
	ans = 0
	r = n - 1
	while s <= r:
		mid = (s + r) // 2
		if l[mid] == i:
			s = mid
			break
		elif l[mid] < i:
			s = mid + 1
		else:
			r = mid - 1
	print(s + 1)


n = input()
a = list(map(int, input().split()))
m = input()
q = map(int, input().split())
pos = []
curr = 1
ind = 0
for i in a:
	for j in range(i):
		pos.append(curr)
		ind += 1
	curr += 1
for i in q:
	print(pos[i - 1])


def worm():
	L = []
	input()
	r = 1
	for k in input().split():
		L += [r] * int(k)
		r += 1
	input()
	for j in input().split():
		print(L[int(j) - 1])
worm()


from itertools import accumulate
from bisect import bisect_left
input()
p = list(accumulate(map(int, input().split())))
input()
for w in map(int, input().split()):
	print(bisect_left(p, w) + 1)


n = int(input())
a = [int(x) for x in input().split()]
q = int(input())
queries = [int(x) for x in input().split()]
ans = list()
for i in range(n):
	for k in range(a[i]):
		ans.append(i)
for x in queries:
	bla = int(x)
	print(ans[x - 1] + 1)


import sys
f = sys.stdin.readline
n = int(f().strip())
arr = [int(v) for v in f().strip().split()]
pre = [0] * n
pre[0] = arr[0]
for i in range(1, n):
	pre[i] += arr[i] + pre[i - 1]
from bisect import bisect_left
m = int(f().strip())
q = [int(v) for v in f().strip().split()]
for v in q:
	i = bisect_left(pre, v)
	print(i + 1)


import os
import sys
from io import BytesIO, IOBase
from itertools import accumulate
from bisect import bisect_left

def solution(arr, brr, n, m):
	arr = list(accumulate(arr))
	for q in brr:
		write(bisect_left(arr, q) + 1)

def main():
	n = r_int()
	arr = r_array()
	m = r_int()
	brr = r_array()
	solution(arr, brr, n, m)
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))

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

def write(*args, end='\n'):
	for x in args:
		sys.stdout.write(str(x) + ' ')
	sys.stdout.write(end)

def r_array():
	return [int(x) for x in input().split()]

def r_int():
	return int(input())
main()


n = int(input())

def Bin(a, b):
	left = 0
	right = n - 1
	while left + 1 < right:
		mid = (left + right) // 2
		if a[mid] == b:
			return mid
		elif a[mid] < b:
			left = mid + 1
		else:
			right = mid
	if a[left] >= b:
		return left
	else:
		return right
a = [0] * n
s = input().split()
for i in range(n):
	a[i] = int(s[i])
for i in range(1, n):
	a[i] += a[i - 1]
m = int(input())
b = [0] * m
t = input().split()
for i in range(m):
	b[i] = int(t[i])
for i in range(m):
	print(Bin(a, b[i]) + 1)


from bisect import bisect
a = int(input())
b = [int(X) for X in input().split()]
c = int(input())
d = [int(X) for X in input().split()]
e = []
sum = b[0]
e.append(sum)
for i in range(1, a):
	sum += b[i]
	e.append(sum)
for i in range(c):
	if d[i] == e[bisect(e, d[i]) - 1]:
		print(bisect(e, d[i]))
	else:
		print(bisect(e, d[i]) + 1)


def binarysearch(a, m, n):
	i = 0
	l = n - 1
	while i <= l:
		mid = (i + l) // 2
		if a[mid] == m:
			return mid
		if m >= a[mid] and m <= a[mid + 1]:
			return mid + 1
		elif m > a[mid]:
			i = mid + 1
		else:
			l = mid - 1
n = int(input())
s = 0
a = [1]
for i in input().split():
	s = s + int(i)
	a.append(s)
m = int(input())
b = [int(i) for i in input().split()]
for i in range(m):
	if b[i] == 1:
		print(1)
	else:
		print(binarysearch(a, b[i], n))


def bin(a, x):
	l = -1
	r = len(a)
	while r > l + 1:
		k = (r + l) // 2
		if a[k] >= x:
			r = k
		else:
			l = k
	return r
n = int(input())
a = [int(i) for i in input().split()]
for i in range(1, len(a)):
	a[i] += a[i - 1]
m = int(input())
b = [int(i) for i in input().split()]
for i in b:
	print(bin(a, i) + 1)


import math
import bisect as bis
import heapq
M = 1000000007
n = int(input())
a = [int(i) for i in input().split()]
for i in range(1, n):
	a[i] += a[i - 1]
m = int(input())
q = [int(i) for i in input().split()]
for e in q:
	p = bis.bisect_left(a, e)
	print(p + 1)


import bisect
nw = int(input())
w = input().split(' ')
wa = [int(w[0])]
for i in range(1, nw):
	wa.append(int(w[i]) + int(wa[i - 1]))
np = int(input())
p = input().split(' ')
for i in range(np):
	print(bisect.bisect_left(wa, int(p[i])) + 1)


from sys import stdin

def get_closest_binary(num, l):
	if num > l[-1]:
		return l[-1]
	elif num < l[0]:
		return 0
	else:
		m = 0
		ma = len(l) - 1
		while ma - m > 1:
			if num > l[m + (ma - m) // 2]:
				m += (ma - m) // 2
			else:
				ma -= (ma - m) // 2 + 1
		if num > l[ma]:
			return ma
		else:
			return m
n = int(stdin.readline().rstrip())
p = list(map(int, stdin.readline().rstrip().split(' ')))
t = int(stdin.readline().rstrip())
a = list(map(int, stdin.readline().rstrip().split(' ')))
l = [0] * (n + 1)
for i in range(1, n + 1):
	l[i] = l[i - 1] + p[i - 1]
for j in a:
	print(get_closest_binary(j, l) + 1)


import bisect
n = int(input())
l = [int(x) for x in input().split()]
a = [l[0]]
for i in range(1, n):
	a += [a[i - 1] + l[i]]
q = int(input())
m = [int(x) for x in input().split()]
for i in range(len(m)):
	if m[i] <= a[0]:
		print(1)
		continue
	res = bisect.bisect_left(a, m[i])
	print(res + 1)


n = int(input())
k = input().split()
s = list()
t = {}
O = 0
q = 0
p = int(k[q])
for i in range(n):
	for j in range(int(k[i])):
		s.append(O + 1)
		O += 1
for l in range(len(s)):
	if l + 1 <= int(p):
		t[l + 1] = q + 1
	elif l == len(s):
		q += 1
		t[l + 1] = q + 1
	else:
		q += 1
		t[l + 1] = q + 1
		p = p + int(k[q])
kc = int(input())
nc = input().split()
for g in range(len(nc)):
	print(t[int(nc[g])])


import bisect

def solve():
	n = int(input())
	a = list(map(int, input().split()))
	p = [0] * len(a)
	p[0] = a[0]
	for i in range(1, len(a)):
		p[i] = p[i - 1] + a[i]
	m = int(input())
	l = list(map(int, input().split()))
	for i in l:
		x = bisect.bisect_left(p, i)
		print(x + 1)
solve()


from bisect import *
n = int(input())
a = [int(i) for i in input().split()]
p = [0]
for i in a:
	p.append(i + p[-1])
input()
for i in input().split():
	print(bisect_left(p, int(i)))


n = int(input())
piles = [int(i) for i in input().split()]
m = int(input())
worms = [int(i) for i in input().split()]
data = []
for i in range(n):
	data += [i + 1] * piles[i]
for i in worms:
	print(data[i - 1])


n = int(input())
c = list(map(int, input().split()))
p = dict()
k = 1
for i in range(n):
	for j in range(c[i]):
		p[k + j] = i + 1
	k += c[i]
m = input()
c = list(map(int, input().split()))
for i in c:
	print(p[i])


from sys import stdin, stdout

def main():
	le = int(stdin.readline())
	d = {}
	pos = 1
	val = [int(x) for x in stdin.readline().split()]
	for k in range(le):
		for i in range(val[k]):
			d[pos] = k + 1
			pos += 1
	la = int(stdin.readline())
	for i in map(int, stdin.readline().split()):
		print(d[i])
main()


from itertools import accumulate

def bin_search(x, left, right, num_list):
	if right - left <= 1:
		if x <= num_list[left]:
			return left + 1
		else:
			return right + 1
	else:
		middle = (left + right) // 2
		if x < num_list[middle]:
			return bin_search(x, left, middle, num_list)
		elif x > num_list[middle]:
			return bin_search(x, middle + 1, right, num_list)
		else:
			return middle + 1
n = int(input())
counter = 1
heap = 0
worms = [0]
for num in input().split():
	heap += 1
	for i in range(counter, counter + int(num)):
		worms.append(heap)
m = int(input())
for request in input().split():
	print(worms[int(request)])


n = int(input())
l1 = list(map(int, input().split()))
m = int(input())
jworms = list(map(int, input().split()))
(newl, index) = ([], 1)
for i in l1:
	for j in range(i):
		newl.append(index)
	index += 1
for i in jworms:
	print(newl[i - 1])


import bisect
n = int(input())
lst = [i for i in map(int, input().split())]
for i in range(1, len(lst)):
	lst[i] += lst[i - 1]
_ = input()
for item in map(int, input().split()):
	print(bisect.bisect_left(lst, item) + 1)


def binarySearch(value, xList):
	low = 0
	high = len(xList)
	while low != high:
		mid = (low + high) // 2
		if xList[mid] <= value:
			low = mid + 1
		else:
			high = mid
	return low
n = int(input())
tmp = list(map(int, input().split()))
k = int(input())
ask = list(map(int, input().split()))
for i in range(1, len(tmp)):
	tmp[i] += tmp[i - 1]
for i in range(len(tmp)):
	tmp[i] += 1
for item in ask:
	x = binarySearch(item, tmp)
	print(x + 1)


N = int(input())
L = list(map(int, input().split()))
J = int(input())
L1 = list(map(int, input().split()))
NewL = [0] * sum(L)
temp = 0
for i in range(N):
	for j in range(L[i]):
		NewL[temp + j] = i + 1
	temp += L[i]
for i in L1:
	print(NewL[i - 1])


n = int(input())
a = [int(i) for i in input().split(' ')]
x = int(input())
b = [int(i) for i in input().split(' ')]
result = []
for (idx, i) in enumerate(a):
	result += [idx + 1] * i
for (idx, i) in enumerate(b):
	print(result[i - 1])


import sys
import math
a = int(input())
b = list(map(int, input().split()))
c = int(input())
d = list(map(int, input().split()))
e = []
f = 0
for i in b:
	e.append(f + i)
	f = i + f
g = [0] * (e[-1] + 1)
h = 0
for i in range(a):
	for j in range(h, e[i] + 1):
		g[j] = i + 1
	h = e[i] + 1
for k in d:
	print(g[k])


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	n = I()
	a = LI()
	m = I()
	q = LI()
	w = [0]
	for c in a:
		w.append(w[-1] + c)
	r = []
	for c in q:
		r.append(bisect.bisect_left(w, c))
	return '\n'.join(map(str, r))
print(main())


import math
from bisect import bisect_left, bisect, bisect_right
from itertools import accumulate
import math

def find_ge(a, x):
	i = bisect_left(a, x)
	if i != len(a):
		return i
st = ''

def func(n, l1):
	return find_ge(l1, n) + 1
for _ in range(1):
	n = int(input())
	l1 = list(map(int, input().split()))
	l1 = list(accumulate(l1))
	q = int(input())
	l2 = list(map(int, input().split()))
	for i in l2:
		st += str(int(func(i, l1))) + '\n'
print(st)


def func(arr, x):
	i = 0
	j = len(arr) - 1
	while i <= j:
		mid = (i + j) // 2
		if mid == 0:
			if x >= 1 and x <= arr[mid]:
				return mid + 1
			else:
				return mid + 2
		if x <= arr[mid] and x >= arr[mid - 1] + 1:
			return mid + 1
		elif x > arr[mid]:
			i = mid + 1
		elif x < arr[mid - 1] + 1:
			j = mid - 1
n = int(input())
a = [int(x) for x in input().split()]
k = int(input())
labels = [int(x) for x in input().split()]
for i in range(1, n):
	a[i] = a[i] + a[i - 1]
for x in labels:
	print(func(a, x))


from math import *
from copy import *
from string import *
from random import *
from sys import stdin
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
import math

def bin1(l, r, k, t, b, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		v = k ** mid
		if v == val:
			return v
		elif v > val:
			ans = mid
			return bin1(mid + 1, r, k, t, b, val, ans)
		else:
			return bin1(l, mid - 1, k, t, b, val, ans)

def bin2(l, r, k, t, b, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		v = t * k ** mid + b * mid
		if v == val:
			return v
		elif v > val:
			ans = mid
			return bin2(l, mid - 1, k, t, b, val, ans)
		else:
			return bin2(mid + 1, r, k, t, b, val, ans)

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def bin(l, r, ll, val):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		if val >= ll[mid][0] and val <= ll[mid][1]:
			return mid
		elif val < ll[mid][0]:
			return bin(l, mid - 1, ll, val)
		else:
			return bin(mid + 1, r, ll, val)
n = int(input())
l = list(map(int, input().split(' ')))
ll = []
c = 1
for i in range(n):
	l1 = []
	l1.append(c)
	l1.append(c + l[i] - 1)
	ll.append(l1)
	c = l1[1] + 1
m = int(input())
nl = list(map(int, input().split(' ')))
for i in range(m):
	print(bin(0, n - 1, ll, nl[i]) + 1)


n = int(input())
a = [int(i) for i in input().split()]
pref = [0] * n
k = 0
for i in range(n):
	k += a[i]
	pref[i] = k
qs = int(input())
q = [int(i) for i in input().split()]
for x in q:
	(l, r) = (-1, n - 1)
	while l + 1 < r:
		m = (l + r) // 2
		if pref[m] >= x:
			r = m
		else:
			l = m
	print(r + 1)


def binary(a, n, ele):
	l = 0
	h = n - 1
	ans = -1
	while l <= h:
		m = (l + h) // 2
		if a[m] == ele:
			return m + 1
		elif a[m] < ele:
			l = m + 1
		elif a[m] > ele:
			ans = m + 1
			h = m - 1
	if ans == -1:
		return n
	return ans
n = int(input())
a = list(map(int, input().split()))
ans = []
for i in range(n):
	for j in range(a[i]):
		ans.append(i + 1)
m = int(input())
q = list(map(int, input().split()))
for i in q:
	print(ans[i - 1])


from bisect import bisect_left

def find(a, x):
	i = bisect_left(a, x)
	return i
	raise ValueError
n = int(input())
d = input().split()
d = [int(i) for i in d]
m = int(input())
l = input().split()
l = [int(i) for i in l]
for i in range(1, n):
	d[i] += d[i - 1]
d = [0] + d
for j in l:
	i = find(d, j)
	print(i)


from collections import deque

def Bsearch(arr, x):
	(l, r) = (0, len(arr) - 1)
	while l <= r:
		mid = l + (r - l) // 2
		if arr[mid] < x:
			l = mid + 1
		elif arr[mid] > x:
			r = mid - 1
		else:
			return mid + 1
	if arr[l] > x:
		return l + 1
	else:
		return r + 1
n = int(input())
l1 = list(map(int, input().split()))
m = int(input())
l2 = list(map(int, input().split()))
a = deque()
a.append(l1[0])
for i in range(1, n):
	a.append(a[-1] + l1[i])
a = sorted(a)
for i in range(m):
	r = Bsearch(a, l2[i])
	print(r)


from collections import Counter
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys

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

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

def tinput():
	return input().split()

def rinput():
	return map(int, tinput())

def rlinput():
	return list(rinput())
mod = int(1000000000.0) + 7
n = iinput()
a = rlinput()
m = iinput()
j = rlinput()
sample = []
pos = 1
for i in a:
	sample += [pos] * i
	pos += 1
for i in j:
	print(sample[i - 1])


import sys
import math
import collections
import operator as op
from collections import deque
from math import gcd, inf, sqrt, pi, cos, sin, ceil, log2
from bisect import bisect_right, bisect_left
from functools import reduce
from sys import stdin, stdout, setrecursionlimit
setrecursionlimit(2 ** 20)

def factorial(n):
	if n == 0:
		return 1
	return n * factorial(n - 1)

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return list(factors)

def sumDigits(no):
	return 0 if no == 0 else int(no % 10) + sumDigits(int(no / 10))
MOD = 1000000007
PMOD = 998244353
N = 10 ** 5
T = 1
for _ in range(T):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().rstrip().split()))
	q = int(stdin.readline())
	s = list(map(int, stdin.readline().rstrip().split()))
	p = [0] * n
	p[0] = a[0]
	for i in range(1, n):
		p[i] = p[i - 1] + a[i]
	for i in range(q):
		ix = bisect_left(p, s[i])
		print(ix + 1)


n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
i = 1
while i < n:
	a[i] = a[i - 1] + a[i]
	i = i + 1
totalLen = a[-1]
table = [0] * (totalLen + 1)
i = 1
j = 0
while i <= totalLen:
	if i <= a[j]:
		table[i] = j + 1
	else:
		j = j + 1
		table[i] = j + 1
	i = i + 1
for qut in q:
	print(table[qut])


import os
import sys
from io import BytesIO, IOBase
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')
import math

def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer
for t in range(1):
	n = int(input())
	worms = list(map(int, input().split()))
	for i in range(1, n):
		worms[i] += worms[i - 1]
	m = int(input())
	queries = list(map(int, input().split()))
	for i in queries:
		print(lower_bound(worms, i) + 1)


def bsearch(arr, element):
	start = 0
	end = len(arr) - 1
	while start <= end:
		mid = (start + end) // 2
		mid_element = arr[mid]
		if element < mid_element:
			end = mid - 1
		elif element > mid_element:
			start = mid + 1
		else:
			return mid + 1
	if arr[start] > element:
		return start + 1
	else:
		return end + 1
n = int(input())
ln = list(map(int, input().split()))
m = int(input())
lm = list(map(int, input().split()))
ar = []
l = 0
for i in range(n):
	ar.append(l + ln[i])
	l = ar[i]
for j in lm:
	print(bsearch(ar, j))


import itertools as ittls
from collections import Counter
import re

def inputarray(func=int):
	return map(func, input().split())
n = int(input())
A = list(inputarray())
m = int(input())
B = inputarray()
W = [None] * (10 ** 6 + 1)
for i in range(1, len(A)):
	A[i] = A[i] + A[i - 1]
for i in range(1, A[0] + 1):
	W[i] = 1
for i in range(1, len(A)):
	for j in range(A[i - 1] + 1, A[i] + 1):
		W[j] = i + 1
for num in B:
	print(W[num])


import bisect
x = int(input())
a = list(map(int, input().split()))
b = []
s = 0
y = int(input())
c = list(map(int, input().split()))
for i in range(len(a)):
	s = s + a[i]
	b.append(s)
for j in range(len(c)):
	z = bisect.bisect_right(b, c[j], 0, len(b) - 1)
	if c[j] == 0:
		print(0)
	elif b[z - 1] == c[j]:
		print(z)
	elif b[z] >= c[j]:
		print(z + 1)


from sys import stdin
from bisect import bisect_left

def iinput():
	return int(stdin.readline())

def minput():
	return map(int, stdin.readline().split())

def linput():
	return list(map(int, stdin.readline().split()))
n = iinput()
a = linput()
m = iinput()
q = linput()
worm = [1]
for i in range(n - 1):
	worm.append(worm[-1] + a[i])
for i in range(m):
	x = bisect_left(worm, q[i])
	if x == 0:
		print(1)
	elif x == len(worm):
		print(len(worm))
	elif worm[x] == q[i]:
		print(x + 1)
	else:
		print(x)


n = int(input())

def getAns(k, arr, start, end):
	if start >= end:
		return end
	mid = (start + end) // 2
	if arr[mid] == k:
		return mid
	elif arr[mid] > k:
		return getAns(k, arr, start, mid)
	elif arr[mid] < k:
		return getAns(k, arr, mid + 1, end)
nums = list(map(int, input().split()))
sums = [nums[0]]
for i in range(1, n):
	sums.append(nums[i] + sums[i - 1])
m = int(input())
q = list(map(int, input().split()))
for i in range(m):
	print(getAns(q[i], sums, 0, n) + 1)


import bisect
input()
piles = list(map(int, input().split()))
for i in range(len(piles) - 1):
	piles[i + 1] += piles[i]
input()
worms = list(map(int, input().split()))

def bsearch(lis, x):
	lo = 0
	hi = len(lis)
	while lo < hi:
		mid = (lo + hi) // 2
		if lis[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo
for worm in worms:
	print(bisect.bisect_left(piles, worm) + 1)


n = int(input())
worms = [int(x) for x in input().split()]
m = int(input())
jucy = [int(x) for x in input().split()]
label = []
i = 1
for x in worms:
	for j in range(0, x):
		label.append(i)
	i += 1
for x in jucy:
	print(label[x - 1])


def bsearch(arr, el):
	start = 0
	end = len(arr) - 1
	while start <= end:
		mid = (start + end) // 2
		if arr[mid] > el:
			end = mid - 1
		elif arr[mid] < el:
			start = mid + 1
		else:
			return mid + 1
	if arr[start] > el:
		return start + 1
	else:
		return end + 1
input()
arr = list(map(int, input().split()))
input()
arr_mod = [arr[0]]
for j in arr[1:]:
	arr_mod.append(arr_mod[-1] + j)
to_search = list(map(int, input().split()))
s = ''
for j in to_search:
	s += str(bsearch(arr_mod, j)) + '\n'
print(s)


import bisect
n = int(input())
vals = [*map(int, input().split())]
m = int(input())
queries = [*map(int, input().split())]
for i in range(1, n):
	vals[i] += vals[i - 1]
for query in queries:
	print(bisect.bisect_left(vals, query) + 1)


arr = []
k = 1
n = int(input())
tmp = list(map(int, input().split()))
for i in range(n):
	arr += [k] * tmp[i]
	k += 1
m = int(input())
tmp = list(map(int, input().split()))
for i in range(m):
	print(arr[tmp[i] - 1])


x = int(input())
li = list(map(int, input().split()))
y = int(input())
li1 = list(map(int, input().split()))
li2 = []
for i in range(x):
	li2 += [i + 1] * li[i]
for i in li1:
	print(li2[i - 1])


from sys import stdin
from bisect import bisect_left as bisect
from itertools import accumulate
test_case = stdin.readlines()
worms = [int(c) for c in test_case[1].split()]
queries = [int(c) for c in test_case[3].split()]
worms_acc = list(accumulate(worms))
ans = [bisect(worms_acc, q) + 1 for q in queries]
print('\n'.join(map(str, ans)))


from bisect import bisect
n = int(input())
a = [int(x) for x in input().split()]
m = int(input())
q = [int(x) for x in input().split()]
ranges = [1]
for i in a:
	ranges.append(ranges[-1] + i)
ranges.pop()
for i in q:
	print(bisect(ranges, i))


n = int(input())
line = input().split()
worms = [0]
for i in range(n):
	worms += [i + 1] * int(line[i])
input()
line = input().split()
for i in line:
	print(worms[int(i)])


def binarySearch(list, value, length):
	l = 0
	r = length - 1
	while l <= r:
		mid = (l + r) // 2
		if list[mid - 1] == list[length - 1] and list[mid] >= value:
			return mid
		elif list[mid - 1] < value and list[mid] >= value:
			return mid
		elif list[mid] > value:
			r = mid - 1
		elif list[mid] < value:
			l = mid + 1
	return 'Not-found'
n = int(input())
aString = input()
aList = list(aString.split(' '))
aListInt = list(map(int, aList))
m = int(input())
qString = input()
qList = list(qString.split(' '))
qListInt = list(map(int, qList))
partialSum = 0
partialSumList = list()
for i in range(n):
	partialSum = partialSum + aListInt[i]
	partialSumList.append(partialSum)
for i in range(m):
	n = binarySearch(partialSumList, qListInt[i], len(partialSumList))
	print(n + 1)


g = int(input())
b = [int(x) for x in input().split()]
lookup = []
group_no = 0
for x in b:
	group_no += 1
	for j in range(x):
		lookup.append(group_no)
c = int(input())
d = [int(x) for x in input().split()]
for x in d:
	print(lookup[x - 1])


x = int(input())
a = [0]
b = [int(x) for x in input().split()]
for i in range(x):
	for j in range(b[i]):
		a.append(i + 1)
x = int(input())
b = [int(x) for x in input().split()]
for i in range(x):
	print(a[b[i]])


def find(num):
	low = 0
	high = n - 1
	while low < high:
		mid = (low + high) // 2
		if p[mid] >= num:
			high = mid - 1
		else:
			low = mid + 1
	if p[low] < num:
		return low + 1
	else:
		return low
n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
p = [a[0]]
for i in range(1, n):
	p.append(p[-1] + a[i])
for i in range(m):
	print(find(b[i]) + 1)


from bisect import bisect_left
n = int(input())
l = list(map(int, input().split()))
n1 = int(input())
l1 = list(map(int, input().split()))
s = 0
S = []
for i in range(n):
	s = s + l[i]
	S.append(s)
for x in l1:
	print(bisect_left(S, x) + 1)


def main():
	x = int(input())
	lst1 = list(map(int, input().split()))
	y = int(input())
	lst = list(map(int, input().split()))
	sums = []
	for i in range(x):
		sums += [i + 1] * lst1[i]
	for i in lst:
		print(sums[i - 1])
main()


input()
(sp, pos) = ([], 1)
for el in map(int, input().split()):
	sp += [pos] * el
	pos += 1
input()
for el in map(int, input().split()):
	print(sp[el - 1])


a = input()
x = [int(x) for x in input().split()]
s = 0
l = []
b = input()
y = [int(y) for y in input().split()]
for i in x:
	s = s + i
	l.append(s)
ind = 0
w = []
for j in range(1, s + 1):
	if j > l[ind]:
		ind += 1
	w.append(ind + 1)
for k in y:
	print(w[k - 1])


n = int(input())
a = list(map(int, input().split(' ')))
m = int(input())
q = list(map(int, input().split(' ')))
for i in range(1, n):
	a[i] = a[i] + a[i - 1]
l = 0
k = [k for k in range(1000000)]
for i in range(n):
	for j in range(l, a[i]):
		k[j] = i + 1
	l = a[i]
for i in range(m):
	print(k[q[i] - 1])


from bisect import bisect
n = int(input())
l = list(map(int, input().split()))
c = int(input())
a = list(map(int, input().split()))
s = []
t = 1
r = 0
for i in range(0, n):
	s.append(t)
	t = t + l[i]
	r = r + l[i]
	s.append(r)
for i in range(0, c):
	m = bisect(s, a[i])
	if m % 2 == 0:
		print(m // 2)
	else:
		print(m // 2 + 1)


from bisect import bisect_left as b
n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
l = [1]
cur = 0
for i in a:
	cur += i
	l.append(cur)
for i in q:
	print(max(1, b(l, i)))


import math
n = int(input())
a = []
a = list(map(int, input().split()))
b = [0]
k = 0
for i in range(len(a)):
	k += 1
	for j in range(1, a[i] + 1):
		b.append(k)
m = int(input())
p = []
p = list(map(int, input().split()))
for x in range(len(p)):
	print(b[p[x]])


n = int(input())
a1 = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
a2 = [1, a1[0]]
for i in a1[1:]:
	a2.append(a2[-1] + 1)
	a2.append(a2[-1] + i - 1)

def bins(key):
	l = 0
	r = len(a2) - 1
	while r > l + 1:
		m = (r + l) // 2
		if key <= a2[m]:
			r = m
		else:
			l = m
	return r
for i in q:
	print(bins(i) // 2 + 1)


l = []
n = int(input())
r = 1
a = list(map(int, input().split()))
for k in a:
	l += [r] * k
	r += 1
q = int(input())
qr = list(map(int, input().split()))
for q in qr:
	print(l[q - 1])


n = int(input())
a = list(map(int, input().split()))
k = 0
l = []
c = 1
for i in range(len(a)):
	x = a[i]
	for j in range(k, k + x):
		l.append(c)
	c += 1
	k = k + x
t = int(input())
b = list(map(int, input().split()))
for i in b:
	print(l[i - 1])


x = int(input())
l1 = [int(i) for i in input().split()]
y = int(input())
check = [int(i) for i in input().split()]
for i in range(1, x):
	l1[i] += l1[i - 1]
mid = 0
index = 0
flag = 1
for i in range(y):
	l = 0
	h = x - 1
	index = 0
	while l <= h:
		mid = (l + h) // 2
		if l1[0] >= check[i]:
			index = 0
			flag = 1
			break
		elif l1[mid] >= check[i] and l1[mid - 1] < check[i]:
			index = mid
			flag = 1
			break
		elif l1[mid] < check[i]:
			l = mid + 1
		elif l1[mid] > check[i]:
			h = mid - 1
	print(index + 1)


def find_pile(N, Ai_list, m, labels_list):
	for idx in range(1, N):
		Ai_list[idx] += Ai_list[idx - 1]
	max = Ai_list[-1]
	label_mapping = dict()
	ptr = 0
	for i in range(1, max + 1):
		if i <= Ai_list[ptr]:
			label_mapping[i] = ptr + 1
		else:
			label_mapping[i] = ptr + 2
			ptr += 1
	for label in labels_list:
		print(label_mapping[label])
N = int(input())
Ai_list = list(map(int, input().split()))
m = int(input())
labels_list = list(map(int, input().split()))
find_pile(N, Ai_list, m, labels_list)


n = int(input())
heap = list(map(int, input().split()))
t = int(input())
test = list(map(int, input().split()))
res = [0]
for i in range(n):
	res += [i + 1] * heap[i]
for i in range(t):
	print(res[test[i]])


from bisect import bisect_left
from itertools import accumulate
n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
sums = list(accumulate(a))
ans = list()
for e in q:
	print(bisect_left(sums, e) + 1)


def LowerBound(A, key):
	left = -1
	right = len(A)
	while right > left + 1:
		middle = (left + right) // 2
		if A[middle] >= key:
			right = middle
		else:
			left = middle
	return right
n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
A = [a[0]]
for i in range(1, len(a)):
	x = A[i - 1] + a[i]
	A.append(x)
for elem in q:
	i = LowerBound(A, elem)
	print(i + 1)


p = input()
x = list(map(int, input().split()))
o = input()
y = list(map(int, input().split()))
worms = {}
cur_worm = 1
for (knot_number, length) in enumerate(x):
	for _ in range(length):
		worms[cur_worm] = knot_number + 1
		cur_worm += 1
for worm_number in y:
	print(worms[worm_number])


def sol():
	n = int(input())
	A = [int(i) for i in input().split()]
	m = int(input())
	B = [int(i) for i in input().split()]
	C = []
	A.insert(0, 0)
	i = 0
	j = 1
	while j < n + 1:
		for k in range(i, i + A[j]):
			C.append(j)
		i += A[i]
		j += 1
	for i in range(m):
		print(C[B[i] - 1])
sol()


from sys import stdin, stderr

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

def print_err(*args, **kwargs):
	print(*args, file=stderr, **kwargs)

def run():
	(n,) = readInts()
	ais = readInts()
	s = [0 for _ in range(10 ** 6 + 1)]
	cur_ix = 1
	pile = 1
	for ai in ais:
		for si in range(cur_ix, cur_ix + ai):
			s[si] = pile
		pile += 1
		cur_ix += ai
	(m,) = readInts()
	qis = readInts()
	for qi in qis:
		print(s[qi])
run()