There are numbers , and you are given queries. In each query, you are given two integers and .
You are required to print the sum of all the numbers whose frequency of occurrence is between and (including and ). Print a single integer for each query in a new line.
Input format
Output format
For each query, print the sum of all elements of the array whose frequency of occurrence is between and (inclusive) in a new line.
Constraints
In the first query we need to output the sum of all the numbers whose frequency of occurrecne is between 1 and 4 (inclusive). Here all the given numbers have their frequecny between 1 and 4. 3 occurs 3 times, 4 occurs 2 times, 5, 6, 9 occurs 1 time. So total sum would be 3+3+3+4+4+5+6+9 = 37.