#P1618G. Trader Problem

    ID: 6227 Type: RemoteJudge 4000ms 512MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>data structuresdsugreedysortings*2200

Trader Problem

No submission language available for this problem.

Description

Monocarp plays a computer game (yet again!). This game has a unique trading mechanics.

To trade with a character, Monocarp has to choose one of the items he possesses and trade it for some item the other character possesses. Each item has an integer price. If Monocarp's chosen item has price xx, then he can trade it for any item (exactly one item) with price not greater than x+kx+k.

Monocarp initially has nn items, the price of the ii-th item he has is aia_i. The character Monocarp is trading with has mm items, the price of the ii-th item they have is bib_i. Monocarp can trade with this character as many times as he wants (possibly even zero times), each time exchanging one of his items with one of the other character's items according to the aforementioned constraints. Note that if Monocarp gets some item during an exchange, he can trade it for another item (since now the item belongs to him), and vice versa: if Monocarp trades one of his items for another item, he can get his item back by trading something for it.

You have to answer qq queries. Each query consists of one integer, which is the value of kk, and asks you to calculate the maximum possible total cost of items Monocarp can have after some sequence of trades, assuming that he can trade an item of cost xx for an item of cost not greater than x+kx+k during each trade. Note that the queries are independent: the trades do not actually occur, Monocarp only wants to calculate the maximum total cost he can get.

The first line contains three integers nn, mm and qq (1n,m,q21051 \le n, m, q \le 2 \cdot 10^5).

The second line contains nn integers a1,a2,,ana_1, a_2, \dots, a_n (1ai1091 \le a_i \le 10^9) — the prices of the items Monocarp has.

The third line contains mm integers b1,b2,,bmb_1, b_2, \dots, b_m (1bi1091 \le b_i \le 10^9) — the prices of the items the other character has.

The fourth line contains qq integers, where the ii-th integer is the value of kk for the ii-th query (0k1090 \le k \le 10^9).

For each query, print one integer — the maximum possible total cost of items Monocarp can have after some sequence of trades, given the value of kk from the query.

Input

The first line contains three integers nn, mm and qq (1n,m,q21051 \le n, m, q \le 2 \cdot 10^5).

The second line contains nn integers a1,a2,,ana_1, a_2, \dots, a_n (1ai1091 \le a_i \le 10^9) — the prices of the items Monocarp has.

The third line contains mm integers b1,b2,,bmb_1, b_2, \dots, b_m (1bi1091 \le b_i \le 10^9) — the prices of the items the other character has.

The fourth line contains qq integers, where the ii-th integer is the value of kk for the ii-th query (0k1090 \le k \le 10^9).

Output

For each query, print one integer — the maximum possible total cost of items Monocarp can have after some sequence of trades, given the value of kk from the query.

Samples

Sample Input 1

3 4 5
10 30 15
12 31 14 18
0 1 2 3 4

Sample Output 1

55
56
60
64
64