You are given an array A having N integers and Q queries. Each query is described by two integers L and R. For each query, find the number of pairs (i,j) such that L≤i<j≤R and Ai+Aj can be expressed as the sum of one or more prime numbers.
In the sum, you are allowed to use a prime number more than once.
Input format
Output format
For each query, print the number of pairs that satisfies the given conditions in a separate line.
Constraints
1≤T≤102≤N≤1050≤Ai≤1051≤Q≤1051≤L≤R≤N
(4,5)=A4+A5=0+5=5 and 5 can be expressed as the sum of primes (2+3).
In the second query pairs will be (1,2),(1,3),(1,4),(1,5),(2,3),(2,4),(2,5),(3,5),(4,5).