Ответ:
t = »’\
5
100
222
300
444
500
2
4»’
#ls = tuple(map(int, t.split(»)))
n, t2 = t.split(», 1)
n = int(n)
t3, p, q = t2.rsplit(», 2)
ls = t3.split(»)
ls = tuple(map(int, ls))
p = int(p)
q = int(q)
#print(locals())
assert(len(ls) == n)
print(sum(ls[p — 1:q]))