import sys

n, q = map(int, sys.stdin.readline().split())
a = list(map(int, sys.stdin.readline().split()))
ps_a = []
s = 0

for i in range(n):
    s += a[i]
    ps_a.append(s)

for _ in range(q):
    t, l, r = map(int, sys.stdin.readline().split())
    print((r-l+1)//2*2 )