You are given an array A containing N integers. You have to answer Q queries.
Queries are of form:
L R
Here you have to fInd sum of all numbers , for those which has odd frequency in subarray L to R
INPUT CONSTRAINTS
INPUT FORMAT
First line of input contains a single integer , next line contains space separated integers, elements of array . Next line of input contains a single integer . lines follow each containing two space separated integer and .
OUTPUT Fvv
For each query, print the answer to the query in new line.
Hint:
Mo's Algorithm
For query 1: 1 has frequency 1 and 2 has frequency 2 so, answer is 1
For query 2: 1 has frequency 1 and 2 has frequency 3 So, answer is 7