There is only one test case for this question.
In the first line contains a positive integer $n$ ($n \leq 100000$) represents the length of the sequence.
In the second line contains n positive integers, The i-th number in the sequence represents the weight $c_i$ ($1 \leq c_i \leq n$)of the i-th position.
In the third line, a positive integer $Q$ ($Q \leq 100000$) represents the number of queries.
In the next Q line, each line has four positive integers $l$, $r$, $a$, $b$ ($1 \leq l \leq r \leq n, a \leq n+1,b \leq n+1$), which represent the parameters of the query.