{"raw_statement":[{"iden":"statement","content":"De Prezer loves rectangles.He has a n × m rectangle which there is a number in each of its cells. We show the number in the j - th column of the i - th row by ai, j.\n\nDe Prezer also loves query. So he gives you q queries. In each query, he gives you number k and asks you to print the number of subrectangles of this rectangle that the difference between the maximum element and the minimum element in them is at most k .\n\nThe first line of input contains 3 integers, n, m and q .\n\nIn the next n lines, there are informations of the rectangle. i - th line among them, contains m space separated integers, ai, 1, ai, 2, ..., ai, m .\n\nThe next q lines, each line contains a single integer k (for that query).\n\n1 ≤ n, m ≤ 400\n\n1 ≤ q ≤ 10\n\n1 ≤ ai, j ≤ 109 (for each 1 ≤ i ≤ n and 1 ≤ j ≤ m)\n\n0 ≤ k ≤ 109 (for each query)\n\nFor each query, print the answer in a single line.\n\n"},{"iden":"input","content":"The first line of input contains 3 integers, n, m and q .In the next n lines, there are informations of the rectangle. i - th line among them, contains m space separated integers, ai, 1, ai, 2, ..., ai, m .The next q lines, each line contains a single integer k (for that query).1 ≤ n, m ≤ 4001 ≤ q ≤ 101 ≤ ai, j ≤ 109 (for each 1 ≤ i ≤ n and 1 ≤ j ≤ m)0 ≤ k ≤ 109 (for each query)"},{"iden":"output","content":"For each query, print the answer in a single line."},{"iden":"examples","content":"Input5 4 6451 451 452 452452 452 452 452451 452 450 450451 451 451 451452 452 450 4500277372672496331311Output421501501508888Input4 5 81314 1287 1286 1290 12951278 1271 1324 1317 12891305 1305 1284 1300 13091318 1296 1301 1274 1315976296835121338164066571165835Output150343582379215077"}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"Let $ n \\in \\mathbb{Z} $ with $ 1 \\leq n \\leq 10^5 $.  \nLet $ n = p_1^{e_1} p_2^{e_2} \\cdots p_k^{e_k} $ be the prime factorization of $ n $, where $ p_1 < p_2 < \\cdots < p_k $ are distinct primes and $ e_i \\geq 1 $.  \n\n**Objective**:  \nCompute $ \\sum_{i=1}^k p_i $, the sum of the distinct prime factors of $ n $, and store it in the first storage.","simple_statement":"Given a number n, compute the sum of all its distinct prime factors.","has_page_source":false}