
ZOJ Problem Set  2757
Now you play the following game with your friend. Your friend writes down a sequence of numbers. He chooses some continuous subsequences (for example the subsequence from the second to the fifth number inclusively), and tells you the sums of the subsequences. Then he chooses some other continuous sequences and asks you the sums of them. Can you answer the questions? Input Input consists of multiple cases.
The first of each case contain three integer n, m and k(1 ≤ n ≤ 5000, 0 ≤ m, k ≤ 10000).Integer n is the length of the subsequences, m is the number of sums which your friend tells you, k is the number of questions you should answer. There are three integers a, b and s (1 ≤ a ≤ b ≤ n, 100,000,000 ≤ s ≤ 100,000,000) in the following m lines. They mean the sum of the subsequence from the a th to the b th number inclusively is s. Each of the following k lines contains two integer c, d(1 ≤ c ≤ d ≤ n).
Output You should output the sum of the continuous subsequences from c th to d th number in a single line for each question. If you can't find the answer output "UNKNOWN" in a single line.
Output one blank line after each test case.
Hint: Input will not be selfcontradictory Sample Input
10 5 5 Sample Output
9 Author: ZHANG, Zhetao Source: ZOJ Monthly, September 2006 