#include <bits/stdc++.h>
const int N = 4e5 + 10;
using namespace std;
long long ne[N], Length[N], query[N];
vector<pair<long long, long long> > qs, seg;
pair<long long, long long> a[N];
long long st[N], sum[N], ans;
int n, m, q;
long long Find(long long x) {
  if (ne[x] == x)
    return x;
  else
    ne[x] = Find(ne[x]);
  return ne[x];
}
void Merge(long long a, long long b) {
  long long x = Find(a), y = Find(b);
  long long L = a - Length[x], R = a + Length[y];
  long long l1 = a - (st[a] - st[L]), r1 = a;
  long long r2 = R, l2 = r2 - (st[r2] - st[a]);
  ans -= sum[r2] - sum[l2] + sum[r1] - sum[l1];
  Length[y] = Length[x] + Length[y];
  ne[x] = y;
  ans += sum[r2] - sum[r2 - st[r2] + st[L]];
}
int main() {
  cin >> n >> m >> q;
  for (int i = 1; i <= n; i++) {
    long long x;
    cin >> x;
    a[i] = {x, 1};
    ans += x;
  }
  for (int i = n + 1; i <= n + m; i++) {
    long long x;
    cin >> x;
    a[i] = {x, 0};
  }
  sort(a + 1, a + n + m + 1);
  for (int i = 2; i <= n + m; i++) {
    seg.push_back({a[i].first - a[i - 1].first, (long long)i - 1});
  }
  sort(seg.begin(), seg.end());
  for (int i = 1; i <= n + m; i++) {
    st[i] = st[i - 1] + a[i].second;
    sum[i] = sum[i - 1] + a[i].first;
  }
  for (int i = 1; i <= q; i++) {
    long long x;
    cin >> x;
    qs.push_back({x, (long long)i});
  }
  sort(qs.begin(), qs.end());
  int p = 0;
  for (int i = 1; i <= n + m; i++) ne[i] = (long long)i;
  for (int i = 1; i <= n + m; i++) Length[i] = 1;
  long long las = -1;
  for (auto t : qs) {
    long long i = t.first;
    if (i == las) {
      query[t.second] = ans;
      continue;
    }
    las = i;
    while (p < seg.size() && seg[p].first <= i) {
      Merge(seg[p].second, seg[p].second + 1);
      p++;
    }
    query[t.second] = ans;
  }
  for (int i = 1; i <= q; i++) {
    cout << query[i] << endl;
  }
}

### Prompt

Please formulate a cpp solution to the following problem:

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 x, then he can trade it for any item (exactly one item) with price not greater than x+k.

Monocarp initially has n items, the price of the i-th item he has is a_i. The character Monocarp is trading with has m items, the price of the i-th item they have is b_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 q queries. Each query consists of one integer, which is the value of k, 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 x for an item of cost not greater than x+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.

Input

The first line contains three integers n, m and q (1 ≤ n, m, q ≤ 2 ⋅ 10^5).

The second line contains n integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ 10^9) — the prices of the items Monocarp has.

The third line contains m integers b_1, b_2, ..., b_m (1 ≤ b_i ≤ 10^9) — the prices of the items the other character has.

The fourth line contains q integers, where the i-th integer is the value of k for the i-th query (0 ≤ k ≤ 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 k from the query.

Example

Input


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


Output


55
56
60
64
64

### Response

```cpp
#include <bits/stdc++.h>
const int N = 4e5 + 10;
using namespace std;
long long ne[N], Length[N], query[N];
vector<pair<long long, long long> > qs, seg;
pair<long long, long long> a[N];
long long st[N], sum[N], ans;
int n, m, q;
long long Find(long long x) {
  if (ne[x] == x)
    return x;
  else
    ne[x] = Find(ne[x]);
  return ne[x];
}
void Merge(long long a, long long b) {
  long long x = Find(a), y = Find(b);
  long long L = a - Length[x], R = a + Length[y];
  long long l1 = a - (st[a] - st[L]), r1 = a;
  long long r2 = R, l2 = r2 - (st[r2] - st[a]);
  ans -= sum[r2] - sum[l2] + sum[r1] - sum[l1];
  Length[y] = Length[x] + Length[y];
  ne[x] = y;
  ans += sum[r2] - sum[r2 - st[r2] + st[L]];
}
int main() {
  cin >> n >> m >> q;
  for (int i = 1; i <= n; i++) {
    long long x;
    cin >> x;
    a[i] = {x, 1};
    ans += x;
  }
  for (int i = n + 1; i <= n + m; i++) {
    long long x;
    cin >> x;
    a[i] = {x, 0};
  }
  sort(a + 1, a + n + m + 1);
  for (int i = 2; i <= n + m; i++) {
    seg.push_back({a[i].first - a[i - 1].first, (long long)i - 1});
  }
  sort(seg.begin(), seg.end());
  for (int i = 1; i <= n + m; i++) {
    st[i] = st[i - 1] + a[i].second;
    sum[i] = sum[i - 1] + a[i].first;
  }
  for (int i = 1; i <= q; i++) {
    long long x;
    cin >> x;
    qs.push_back({x, (long long)i});
  }
  sort(qs.begin(), qs.end());
  int p = 0;
  for (int i = 1; i <= n + m; i++) ne[i] = (long long)i;
  for (int i = 1; i <= n + m; i++) Length[i] = 1;
  long long las = -1;
  for (auto t : qs) {
    long long i = t.first;
    if (i == las) {
      query[t.second] = ans;
      continue;
    }
    las = i;
    while (p < seg.size() && seg[p].first <= i) {
      Merge(seg[p].second, seg[p].second + 1);
      p++;
    }
    query[t.second] = ans;
  }
  for (int i = 1; i <= q; i++) {
    cout << query[i] << endl;
  }
}

```