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=map(int,raw_input().split())

a=map(int,raw_input().split())
b=map(int,raw_input().split())

for i in range(2,n):
	a[i]+=a[i-2]
	b[i]+=b[i-2]
	
a.insert(0,0)
b.insert(0,0)
while(q>0):
	t,l,r=map(int,raw_input().split())
	al=0
	ar=0
	bl=0
	br=0
	if(t==1):
		if(l%2==r%2):
			if(l-2>=0):
				al=l-2
			ar=r
			br=r-1
			l+=1
			if(l-2>=0):
				bl=l-2
		else:
			if(l-2>=0):
				al=l-2
			br=r
			ar=r-1
			l+=1
			if(l-2>=0):
				bl=l-2
		ans=b[br]-b[bl]+a[ar]-a[al]
		print ans
	else:
		if(l%2==r%2):
			if(l-2>=0):
				bl=l-2
			br=r
			ar=r-1
			l+=1
			if(l-2>=0):
				al=l-2
		else:
			if(l-2>=0):
				bl=l-2
			ar=r
			br=r-1
			l+=1
			if(l-2>=0):
				al=l-2
		ans=b[br]-b[bl]+a[ar]-a[al]
		print ans
		
		
	q-=1