/*
* 快速找到一段区间数据的和
* [r,l] = s[l] - s[r-1];
/
import java.util.Scanner;
/*
* 5 3
* 2 1 3 6 4
* 1 2
* 1 3
* 2 4
/
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int p = scanner.nextInt();
int[] arr = new int[n];
for(int i=0;i[HTML_REMOVED]0){
int l = scanner.nextInt();
int r = scanner.nextInt();
//[r,l] = S[l]-S[r-1];
int ans = prSum[r] - prSum[l-1];
System.out.println(ans);
}
}
}