xsquare-and-two-arrays
Source: hackerearth
Difficulty: EASY

Xsquare loves to play with arrays a lot. Today, he has two arrays named as A and B. Each array consists of N positive integers. 

Xsquare has decided to fulfill following  types of queries over his array A and array B.
1 L R :  Print the value of AL + BL+1 + AL+2 + BL+3 + ... upto R^th term.
2 L R :  Print the value of BL + AL+1 + BL+2 + AL+3 + ... upto R^th term.

Input
First line of input contains two space separated integers N and Q denoting the size of arrays ( A , B ) and number of queries respectively. Next N lines of input contains N space separated integers denoting array A. Next line of input contains N space separated integers denoting array B. Next Q lines of input contains Q queries (one per line). Each query has one of the above mentioned types.

Output
Output consists of Q lines, each containing answer to the corresponding query.

Constraints

1 ≤ N,Q ≤ 10^5
1 ≤ Ai,Bi ≤ 10^9
1 ≤ L,R ≤ N

SAMPLE INPUT
5 5
1 2 3 4 5
5 4 3 2 1
1 1 5
2 1 5
1 2 4
2 2 4
1 3 5


SAMPLE OUTPUT
15
15
9
9
10

Explanation

Q1 : A[1] + B[2] + A[3] + B[4] + A[5] = 1 + 4 + 3 + 2 + 5 = 15
Q2 : B[1] + A[2] + B[3] + A[4] + B[5] = 5 + 2 + 3 + 4 + 1 = 15 
Q3 : A[2] + B[3] + A[4] = 2 + 3 + 4 = 9 
Q4 : B[2] + A[3] + B[4] = 4 + 3 + 2 = 9
Q5 : A[3] + B[4] + A[5] = 3 + 2 + 5 = 10


N,q = list(map(int,input().split()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
seq_1 = list(map(int ,[0]*N))
seq_2 = list(map(int ,[0]*N))
seq_1[0]=a[0]
seq_2[0]=b[0]
i = 0
for i in range(1,N):
	if i%2 ==0:
		seq_1[i] = a[i]+seq_1[i-1]
		seq_2[i] = b[i]+seq_2[i-1]
	if i%2 !=0:
		seq_1[i] = b[i]+seq_1[i-1]
		seq_2[i] = a[i]+seq_2[i-1]
for i in range(q):
	Q = list(map(int,input().split()))
	if (Q[0]==1 and Q[1]%2!=0)or(Q[0]==2 and Q[1]%2==0):
		if Q[1]==1:
			print(seq_1[Q[2]-1])
		else:
			print(seq_1[Q[2]-1]-seq_1[Q[1]-2])
	else:
		if Q[1]==1:
			print(seq_2[Q[2]-1])
		else:
			print(seq_2[Q[2]-1]-seq_2[Q[1]-2])


# Read input from stdin and provide input before running code
input = input("")
in_list = input.split(' ')
num, numQuery = int(in_list[0]), int(in_list[1])
Araw = input("")
Braw = input("")
A_list = Araw.split(' ')
B_list = Braw.split(' ')
Araw = ""
Braw = ""
sumA = []
sumB = []
A = []
B = []

sumA.append(0)
sumB.append(0)

for i in range(num):
	Ai = int(A_list[i])
	Bi = int(B_list[i])
	sumA.append(Ai+sumB[i])
	sumB.append(Bi+sumA[i])

for j in range(numQuery):
	query = input("")
	q_list = query.split(' ')
	type = int(q_list[0])
	begin= int(q_list[1])
	end = int(q_list[2])
	if type ==1:
		sumBegin = sumB[begin-1]
		if (end-begin)%2:
			sumEnd = sumB[end]
		else:
			sumEnd = sumA[end]
	else:
		sumBegin = sumA[begin-1]
		if (end-begin)%2:
			sumEnd = sumA[end]
		else:
			sumEnd = sumB[end]

	print((sumEnd-sumBegin))



N, Q = input('').split()
N = int(N)
Q = int(Q)

A = list()
B = list()
ASum = list()
BSum = list()

def constructASum():
	for position in range(N):
		if position > 1:
			ASum.append(A[position] + B[position-1] + ASum[position-2])
		elif position == 1:
			ASum.append(A[position] + B[position-1])
		else:
			ASum.append(A[position])

def constructBSum():
	for position in range(N):
		if position > 1:
			BSum.append(B[position] + A[position-1] + BSum[position-2])
		elif position == 1:
			BSum.append(B[position] + A[position-1])
		else:
			BSum.append(B[position])

A = input('').split()
A = [int(number) for number in A]

B = input('').split()
B = [int(number) for number in B]

constructASum()
constructBSum()

for counter in range(Q):
	matrix, L, R = input('').split()
	matrix = int(matrix)
	L = int(L)
	R = int(R)
	if matrix == 1:
		if (R-L)%2 == 0:
			end = ASum[R-1]
		else:
			end = BSum[R-1]
		if L == 1:
			print(end)
		else:
			print(end - BSum[L-1-1])
	else:
		if (R-L)%2 == 0:
			end = BSum[R-1]
		else:
			end = ASum[R-1]
		if L == 1:
			print(end)
		else:
			print(end - ASum[L-1-1])


n,q=list(map(int,input().split()))
a=[0,0]+list(map(int,input().split()))
b=[0,0]+list(map(int,input().split()))
for i in range(4,n+2):
	a[i]+=a[i-2]
	b[i]+=b[i-2]
for i in range(q):
	c,l,r=list(map(int,input().split()))
	if l>r:
		l,r=r,l
	t=l+((r-l)/2)*2
	if t==r:
		r=t-1
	if c==1:
		print(a[t+1]-a[l-1]+b[r+1]-b[l])
	else:
		print(b[t+1]-b[l-1]+a[r+1]-a[l])


from numpy import zeros
(n, q) = (int(x) for x in input().split())

A = input().split()
B = input().split()
ziz_zag_arrays = zeros((2,n), dtype=int)
for i in range(n):
	ziz_zag_arrays[0][i] = int(A[i]) if i%2==0 else int(B[i])
	ziz_zag_arrays[1][i] = int(B[i]) if i%2==0 else int(A[i])
	ziz_zag_arrays[0][i] += ziz_zag_arrays[0][i-1]
	ziz_zag_arrays[1][i] += ziz_zag_arrays[1][i-1]

for _ in range(q):
	(which_array, l, r) = (int(x) for x in input().split())
	
	i = abs(which_array-1-1) if l%2==0 else which_array-1
	print(ziz_zag_arrays[i][r-1] - ziz_zag_arrays[i][l-2] if l>1 else ziz_zag_arrays[i][r-1])
	
	# if l%2==0:
	# 	i = abs(which_array-1-1)
	# 	print sum(ziz_zag_arrays[i][l-1:r])
	# else:
	# 	print sum(ziz_zag_arrays[which_array-1][l-1:r])


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
n,q = list(map(int ,  input().split()))
a = list(map(int ,  input().split()))
b = list(map(int ,  input().split()))
a_1 = [0]*n
b_2 = [0]*n

a_1[n-1] = a[n-1]
a_1[n-2] = a[n-2]

for i in range(n-3 , -1, -1):
	a_1[i] = a[i] + a_1[i+2]


b_2[n-1] = b[n-1]
b_2[n-2] = b[n-2]

for i in range(n-3 , -1, -1):
	b_2[i] = b[i] + b_2[i+2]

a = [-1] + a
b = [-1]+ b
a_1 = [-1]+ a_1
b_2= [-1] + b_2


for i in range(q):
	total = 0
	q1 ,q2,q3 = list(map(int , input().split()))
	if q1 == 1 :
		if (q2 + q3)%2 == 0 and q2 != q3:
			total = a_1[q2] - a_1[q3] +a[q3] + b_2[q2+1] - b_2[q3-1] +b[q3-1]
		elif (q2 + q3)%2 != 0 and q2 != q3:
			total = a_1[q2] - a_1[q3-1] + a[q3-1] + b_2[q2 + 1] - b_2[q3] + b[q3]
		else:
			total = a[q2]
	else:
		if (q2 + q3) % 2 == 0 and q2 != q3:
			total = b_2[q2] - b_2[q3] + b[q3] + a_1[q2 + 1] - a_1[q3 - 1] + a[q3 - 1]
		elif (q2 + q3) % 2 != 0 and q2 != q3:
			total = b_2[q2] - b_2[q3 - 1] + b[q3 - 1] + a_1[q2 + 1] - a_1[q3] + a[q3]
		else:
			total = b[q2]

	print(total)




# Read input from stdin and provide input before running code
in_list = input().split(' ')
num, numQuery = int(in_list[0]), int(in_list[1])
A_list = input().split(' ')
B_list = input().split(' ')
sumA = []
sumB = []

sumA.append(0)
sumB.append(0)

for i in range(num):
	Ai = int(A_list[i])
	Bi = int(B_list[i])
	sumA.append(Ai+sumB[i])
	sumB.append(Bi+sumA[i])

for j in range(numQuery):
	q_list = input().split(' ')
	type, begin, end = int(q_list[0]), int(q_list[1]), int(q_list[2])
	if type ==1:
		sumBegin = sumB[begin-1]
		if (end-begin)%2:
			sumEnd = sumB[end]
		else:
			sumEnd = sumA[end]
	else:
		sumBegin = sumA[begin-1]
		if (end-begin)%2:
			sumEnd = sumA[end]
		else:
			sumEnd = sumB[end]

	print((sumEnd-sumBegin))


# Read input from stdin and provide input before running code
input = input("")
in_list = input.split(' ')
num, numQuery = int(in_list[0]), int(in_list[1])
Araw = input("")
Braw = input("")
A_list = Araw.split(' ')
B_list = Braw.split(' ')
Araw = ""
Braw = ""
sumA = []
sumB = []
A = []
B = []

sumA.append(0)
sumB.append(0)

for i in range(num):
	Ai = int(A_list[i])
	Bi = int(B_list[i])
	sumA.append(Ai+sumB[i])
	sumB.append(Bi+sumA[i])

A_list = ""
B_list = ""

for j in range(numQuery):
	query = input("")
	q_list = query.split(' ')
	type = int(q_list[0])
	begin= int(q_list[1])
	end = int(q_list[2])
	if type ==1:
		sumBegin = sumB[begin-1]
		if (end-begin)%2:
			sumEnd = sumB[end]
		else:
			sumEnd = sumA[end]
	else:
		sumBegin = sumA[begin-1]
		if (end-begin)%2:
			sumEnd = sumA[end]
		else:
			sumEnd = sumB[end]

	print((sumEnd-sumBegin))



n, q = [int(x) for x in input('').split(' ')]
a = [int(x) for x in input('').split(' ') if len(x.strip(' ')) > 0]
b = [int(x) for x in input('').split(' ') if len(x.strip(' ')) > 0]
assert(1 <= n <= 100000)
assert(1 <= q <= 100000)
for i in range(0, n, 2):
	temp = a[i]
	a[i] = b[i]
	b[i] = temp
for i in range(1, n):
	a[i] += a[i - 1]
	b[i] += b[i - 1]
a.insert(0, 0)
b.insert(0, 0)
for i in range(q):
	mode, l, r = [int(x) for x in input('').split(' ')]
	assert(l <= r)
	l -= 1
	if mode == 1:
		if l % 2 != 0:
			print((str(a[r] - a[l])))
		else:
			print((str(b[r] - b[l])))
	else:
		if l % 2 == 0:
			print((str(a[r] - a[l])))
		else:
			print((str(b[r] - b[l])))


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
N, Q = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))

oneArray = [A[0]]
twoArray = [B[0]]
flag = True
for i in range(1,N):
	if flag == True:
		oneArray.append(oneArray[i-1] + B[i])
		twoArray.append(twoArray[i-1] + A[i])
	else:
		oneArray.append(oneArray[i-1] + A[i])
		twoArray.append(twoArray[i-1] + B[i])
	flag = ~flag

sumArray = [oneArray, twoArray]
while Q:
	typ, L, R = list(map(int, input().split()))
	typ -= 1
	L -= 1
	R -= 1
	if typ == 0:
		if L %2 == 0:
			arTyp = 0
		else:
			arTyp = 1
	else:
		if L %2 == 0:
			arTyp = 1
		else:
			arTyp = 0
	
	if L == 0:
		print(sumArray[arTyp][R])
	else:
		print(sumArray[arTyp][R] - sumArray[arTyp][L-1])
	Q -= 1
	



n,q=[int(x) for x in input().split()]
a=[int(x) for x in input().split()]
b=[int(x) for x in input().split()]
sa,sb=[],[]
sa.append(a[0])
sb.append(b[0])
for i in range(1,n):
	if i%2!=0:
		sa.append(sa[i-1]+b[i])
		sb.append(sb[i-1]+a[i])
	else:
		sa.append(sa[i-1]+a[i])
		sb.append(sb[i-1]+b[i])
	
	
#print sa,sb
for _ in range(q):
	s=0
	c,l,r=[int(x)-1 for x in input().split()]
	if c==0:
		if l%2==0:
			if l-1>=0:
				print(sa[r]-sa[l-1])
			else:
				print(sa[r])
		else:
			if l-1>=0:
				print(sb[r]-sb[l-1])
			else:
				print(sb[r])
			
	else:
		if l%2!=0:
			if l-1>=0:
				print(sa[r]-sa[l-1])
			else:
				print(sa[r])
		else:
			if l-1>=0:
				print(sb[r]-sb[l-1])
			else:
				print(sb[r])
		
		
	



'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
ar=list(map(int,input().split()))
n=ar[0]
q=ar[1]
a=list(map(int,input().split()))
b=list(map(int,input().split()))
mat=[]
mat.append([])
mat.append([])
sum1=0
sum2=0
for i in range(n):
	if i%2==0:
		sum1+=a[i]
		sum2+=b[i]
	else:
		sum1+=b[i]
		sum2+=a[i]
	mat[0].append(sum1)
	mat[1].append(sum2)
#print(mat[0])
#print(mat[1])
for i in range(q):
	q=list(map(int,input().split(' ')))
	if q[1]==1:
		print((mat[q[0]-1][q[2]-1]))
	else:
		if q[0]==1:
			if q[1]%2==0:
				print((mat[1][q[2]-1]-mat[1][q[1]-2]))
			else:
				print((mat[0][q[2]-1]-mat[0][q[1]-2]))
		else:
			if q[1]%2==0:
				print((mat[0][q[2]-1]-mat[0][q[1]-2]))
			else:
				print((mat[1][q[2]-1]-mat[1][q[1]-2]))
		#print(mat[q[0]-1][q[2]-1]-mat[q[0]-1][q[1]-1])
		


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''


n1 ,q1 = input().split()

n = int(n1)
q = int(q1)

li1 = list(map(int,input().split()))
li2 = list(map(int,input().split()))

for case in range(0,q):
	
	que = list(map(int,input().split()))
	
	l = que[1] - 1
	r = que[2] 
	
	if que[0] == 1 :
		sum1 = sum(li1[l:r:2])
		sum2 = sum(li2[l+1:r:2])
		print(sum1 + sum2)
		
	if que[0] == 2 :
		sum1 = sum(li2[l:r:2])
		sum2 = sum(li1[l+1:r:2])
		print(sum1 + sum2)
	


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''


n1 ,q1 = input().split()

n = int(n1)
q = int(q1)

li1 = list(map(int,input().split()))
li2 = list(map(int,input().split()))

'''a1 = []
i = 0
for num in li1[ : :2]:
	if i == 0 :
		a1[i] = num
		i = i + 1
	else :
		a1[i] = a1[i-1] + num
		i = i + 1

a2 = []
i = 0
for num in li1[1: :2] :
	if i == 0 :
		a2[i] = num
		i = i + 1
		
	else:
		a2[i] = a2[i-1] + num
		i = i + 1

b1 = []
i = 0
for num in li2[ : :2]:
	if i == 0 :
		b1[i] = num
		i = i + 1
	else :
		b1[i] = b1[i-1] + num
		i = i + 1

b2 = []
i = 0
for num in li2[1: :2] :
	if i == 0 :
		b2[i] = num
		i = i + 1
		
	else:
		b2[i] = b2[i-1] + num
		i = i + 1
'''

for case in range(0,q):
	que = list(map(int,input().split()))
	
	l = que[1] - 1
	r = que[2] 
	
	if que[0] == 1 :
		sum1 = sum(li1[l:r:2])
		sum2 = sum(li2[l+1:r:2])
		print(sum1+sum2)
		
	if que[0] == 2 :
		sum1 = sum(li2[l:r:2])
		sum2 = sum(li1[l+1:r:2])
		print(sum1+sum2)
	


# Read input from stdin and provide input before running code
input = input("")
in_list = input.split(' ')
num, numQuery = int(in_list[0]), int(in_list[1])
Araw = input("")
Braw = input("")
A_list = Araw.split(' ')
B_list = Braw.split(' ')
sumA = []
sumB = []
A = []
B = []

sumA.append(0)
sumB.append(0)

for i in range(num):
	Ai = int(A_list[i])
	Bi = int(B_list[i])
	sumA.append(Ai+sumB[i])
	sumB.append(Bi+sumA[i])

for j in range(numQuery):
	query = input("")
	q_list = query.split(' ')
	type = int(q_list[0])
	begin= int(q_list[1])
	end = int(q_list[2])
	if type ==1:
		sumBegin = sumB[begin-1]
		if (end-begin)%2:
			sumEnd = sumB[end]
		else:
			sumEnd = sumA[end]
	else:
		sumBegin = sumA[begin-1]
		if (end-begin)%2:
			sumEnd = sumA[end]
		else:
			sumEnd = sumB[end]

	print((sumEnd-sumBegin))



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


input = raw_input

n, q = list(map(int, input().split()))
a = [0]+list(map(int, input().split()))
b = [0]+list(map(int, input().split()))
for i in range(2, n+1):
	a[i] += a[i-2]
	b[i] += b[i-2]
for i in range(q):
	op, l, r = list(map(int, input().split()))
	if op == 1:
		if r % 2 == l % 2:
			print((a[r]-a[max(0, l-2)]+b[r-1]-b[l-1]))
		else:
			print((a[r-1]-a[max(0, l-2)]+b[r]-b[l-1]))
	elif op == 2:
		if r % 2 == l % 2:
			print((b[r]-b[max(0, l-2)]+a[r-1]-a[l-1]))
		else:
			print((b[r-1]-b[max(0, l-2)]+a[r]-a[l-1]))            


n,q = list(map(int,input().split()))
a = [0]+list(map(int,input().split()))
b = [0]+list(map(int,input().split()))
for i in range(1,n+1):
	a[i] = a[i]+b[i-1]
	b[i] = b[i]+a[i-1]
#print a
#print b
while q:
	q=q-1
	o,l,r = list(map(int,input().split()))
	if o==1:
		if (r-l+1)%2==0:
			print(b[r]-b[l-	1])
		else:
			print(a[r]-b[l-1])
	else:
		if (r-l+1)%2==0:
			print(a[r]-a[l-	1])
		else:
			print(b[r]-a[l-1])


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''


n1 ,q1 = input().split()

n = int(n1)
q = int(q1)

li1 = list(map(int,input().split()))
li2 = list(map(int,input().split()))

for case in range(0,q):
	que = list(map(int,input().split()))
	
	l = que[1] - 1
	r = que[2] 
	
	if que[0] == 1 :
		sum1 = sum(li1[l:r:2])
		sum2 = sum(li2[l+1:r:2])
		print(sum1 + sum2)
		
	if que[0] == 2 :
		sum1 = sum(li2[l:r:2])
		sum2 = sum(li1[l+1:r:2])
		print(sum1 + sum2)
	


a,b = list(map(int,input().split()))
seriesA = list(map(int,input().split()))
seriesB = list(map(int,input().split()))
while b > 0:
	Q,L,R = list(map(int,input().split()))
	if Q == 1:
		AA =  seriesA[L-1:R:2]
		AB =  seriesB[L:R:2]
	else:
		AA =  seriesA[L:R:2]
		AB =  seriesB[L-1:R:2]
	b-=1    
	print(sum(AA) + sum(AB))



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

a=list(map(int,input().split()))
b=list(map(int,input().split()))
a=[0]+a
b=[0]+b

for i in range(2,n+1,2):
	a[i]=a[i]+a[i-2]
	b[i]=b[i]+b[i-2]

for i in range(3,n+1,2):
	a[i]=a[i]+a[i-2]
	b[i]=b[i]+b[i-2]
	
for _ in range(q):
	
	x,L,R=list(map(int,input().split()))
	
	s=0
	
	if x==1:
		if (R-L)%2==0:
			if L==1:
				s=s+a[R]
			else:
				s=s+a[R]-a[L-2]
			s=s+b[R-1]-b[L-1]
		else:
			if L==1:
				s=s+a[R-1]
			else:
				s=s+a[R-1]-a[L-2]
			s=s+b[R]-b[L-1]
			
	if x==2:
		if (R-L)%2==0:
			if L==1:
				s=s+b[R]
			else:
				s=s+b[R]-b[L-2]
			s=s+a[R-1]-a[L-1]
		else:
			if L==1:
				s=s+b[R-1]
			else:
				s=s+b[R-1]-b[L-2]
			s=s+a[R]-a[L-1]
	
	print(s)


n, q = [int(s) for s in input().split()]
a = [int(s) for s in input().split()]
b = [int(s) for s in input().split()]
ab = [0]
ba = [0]
temp = [a, b]
for i in range(n):
	ab.append(ab[-1] + temp[i%2][i])
	ba.append(ba[-1] + temp[1-i%2][i])
for _ in range(q):
	t, l, r = [int(s) for s in input().split()]
	sq = ab if (t == 1 and l%2 == 1) or (t == 2 and l%2 == 0) else ba
	print(sq[r] - sq[l-1])


#coding=utf-8

def SumA( startA, endA ):
	if startA == endA:
		return A[startA]
	if startA > endA:
		return 0
	
	#偶数
	if startA % 2 == 0:
		if startA == 0:
			return eveA[endA]
		return eveA[endA] - eveA[startA - 2]
	
	if startA == 1:
		return oddA[endA]
	return oddA[endA] - oddA[startA - 2]
	
def SumB( startB, endB ):
	if startB == endB:
		return B[startB]
	if startB > endB:
		return 0
	
	#偶数
	if startB % 2 == 0:
		if startB == 0:
			return eveB[endB]
		return eveB[endB] - eveB[startB - 2]
	
	if startB == 1:
		return oddB[endB]
	return oddB[endB] - oddB[startB - 2]
	
def main():

	global eveA
	global oddA
	global eveB
	global oddB
	global A
	global B

	N,Q = list(map(int, input().strip().split()))
	A = list(map(int, input().strip().split()))
	B = list(map(int, input().strip().split()))

	eveA = [0] * N
	oddA = [0] * N
	eveB = [0] * N
	oddB = [0] * N

	
	
	#计算偶数序列和
	eveA[0] = A[0]
	for i in range( 2, N, 2 ):
		eveA[i] += eveA[i - 2] + A[i]

	if N >= 1:
		oddA[1] = A[1]
		for i in range( 3, N, 2 ):
			oddA[i] += oddA[i - 2] + A[i]
			
			
	eveB[0] = B[0]
	for i in range( 2, N, 2 ):
		eveB[i] += eveB[i - 2] + B[i]

	if N >= 1:
		oddB[1] = B[1]
		for i in range( 3, N, 2 ):
			oddB[i] += oddB[i - 2] + B[i]

	for _ in range( Q ):
		turn, start, end = list(map(int, input().strip().split()))
		start -= 1
		end -= 1
		
		Astart = 0
		Aend = 0
		Bstart = 0
		Bend = 0
		if turn == 1: #A开头
			Astart = start
			Bstart = start + 1
			
			if start % 2 == end % 2:
				Aend = end
				Bend = end - 1
			else:
				Bend = end
				Aend = end - 1
				
		if turn == 2:  #B开头
			Bstart = start
			Astart = start + 1
			
			if start % 2 == end % 2:
				Bend = end
				Aend = end - 1
			else:
				Aend = end
				Bend = end - 1
			
		print(SumA(Astart, Aend) + SumB( Bstart, Bend ))
		
if __name__ == "__main__":
	main()