Problem: In the famous Oh-Suit-United tournament, two teams are playing against each other for the grand prize of precious pepper points.

The first team consists of n players, and the second team consists of m players. Each player has a potential: the potential of the i-th player in the first team is a_i, and the potential of the i-th player in the second team is b_i.

In the tournament, all players will be on the stage in some order. There will be a scoring device, initially assigned to an integer k, which will be used to value the performance of all players.

The scores for all players will be assigned in the order they appear on the stage. Let the potential of the current player be x, and the potential of the previous player be y (y equals x for the first player). Then, x-y is added to the value in the scoring device, Afterwards, if the value in the scoring device becomes negative, the value will be reset to 0. Lastly, the player's score is assigned to the current value on the scoring device. The score of a team is the sum of the scores of all its members.

As an insane fan of the first team, Nezzar desperately wants the biggest win for the first team. He now wonders what is the maximum difference between scores of the first team and the second team.

Formally, let the score of the first team be score_f and the score of the second team be score_s. Nezzar wants to find the maximum value of score_f - score_s over all possible orders of players on the stage.

However, situation often changes and there are q events that will happen. There are three types of events:

  * 1 pos x — change a_{pos} to x; 
  * 2 pos x — change b_{pos} to x; 
  * 3 x — tournament is held with k = x and Nezzar wants you to compute the maximum value of score_f - score_s. 



Can you help Nezzar to answer the queries of the third type?

Input

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

The second line contains n integers a_1, a_2, …, a_n (0 ≤ a_i ≤ 10^6).

The third line contains m integers b_1, b_2, …, b_m (0 ≤ b_i ≤ 10^6).

The following q lines contain descriptions of events, described in the statement, each in one of the three possible formats:

  * 1 pos x (1 ≤ pos ≤ n, 0 ≤ x ≤ 10^6); 
  * 2 pos x (1 ≤ pos ≤ m, 0 ≤ x ≤ 10^6); 
  * 3 x (0 ≤ x ≤ 10^6). 

Output

For each query of the third type print the answer to this query.

Examples

Input


3 4 3
1 2 7
3 4 5 6
3 5
1 1 10
3 5


Output


-4
9


Input


7 8 12
958125 14018 215153 35195 90380 30535 204125
591020 930598 252577 333333 999942 1236 9456 82390
3 123458
2 4 444444
3 123456
1 2 355555
3 123478
3 1111
2 6 340324
3 1111
2 8 999999
2 7 595959
3 222222
3 100


Output


1361307
1361311
1702804
1879305
1821765
1078115
1675180

Note

In the first query of the first test, the tournament is held with k = 5. It would be optimal to arrange players in such way (here their potentials are written):

\underline{7}, 3, 5, 4, 6, \underline{1}, \underline{2} (underlined numbers are potentials of players that are from the first team). 

The individual scores of players, numbered in the order of their appearance, are:

  * max(5 + (7 - 7), 0) = 5 for the \underline{1}-st player; 
  * max(5 + (3 - 7), 0) = 1 for the 2-nd player; 
  * max(1 + (5 - 3), 0) = 3 for the 3-rd player; 
  * max(3 + (4 - 5), 0) = 2 for the 4-th player; 
  * max(2 + (6 - 4), 0) = 4 for the 5-th player; 
  * max(4 + (1 - 6), 0) = 0 for the \underline{6}-th player; 
  * max(0 + (2 - 1), 0) = 1 for the \underline{7}-th player. 



So, score_f = 5 + 0 + 1 = 6 and score_s = 1 + 3 + 2 + 4 = 10. The score difference is 6 - 10 = -4. It can be proven, that it is the maximum possible score difference.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>

const int N = 1000010;
using ll = long long;

using pii = std::pair <int, int>;
std::mt19937 rnd(19971109);

struct Treap{
#define ls(u) (ch[(u)][0])
#define rs(u) (ch[(u)][1])

    int root, node_sz;
    int ch[N][2];
    ll key[N], sz[N], cnt[N], sum[N];
    unsigned prior[N];

    void clear(int x){
        ls(x) = rs(x) = 0;
        key[x] = sz[x] = cnt[x] = sum[x] = 0;
    }

    void init(){
        node_sz = 0;
    }

    int newnode(ll x){
        clear(++ node_sz);
        key[node_sz] = x;
        prior[node_sz] = rnd();
        return node_sz;
    }

    void pull(int u){
        sz[u] = sz[ls(u)] + sz[rs(u)] + cnt[u];
        sum[u] = sum[ls(u)] + sum[rs(u)] + cnt[u] * key[u];
    }

    pii split(int p, ll u){
        if (!p) return {0, 0};
        if (key[p] <= u){
            pii ret = split(rs(p), u);
            rs(p) = ret.first;
            pull(p);
            return {p, ret.second};
        }
        pii ret = split(ls(p), u);
        ls(p) = ret.second;
        pull(p);
        return {ret.first, p};
    }

    int merge(int u, int v){
        if (!u || !v) return u ^ v;
        if (prior[u] > prior[v]){
            rs(u) = merge(rs(u), v);
            pull(u);
            return u;
        }
        ls(v) = merge(u, ls(v));
        pull(v);
        return v;
    }

    ll begin(){
        int p = root;
        while (ls(p)) p = ls(p);
        return key[p];
    }

    ll end(){
        int p = root;
        while (rs(p)) p = rs(p);
        return key[p];
    }

    int right(int p){
        while (rs(p)) p = rs(p);
        return p;
    }

    void insert(ll x){
        pii pair = split(root, x);
        int p = right(pair.first);
        pii pair1;
        if (p && key[p] == x){
            pair1 = split(pair.first, x - 1);
        }
        else{
            pair1 = {pair.first, newnode(x)};
        }
        ++ cnt[pair1.second], ++ sz[pair1.second];
        sum[pair1.second] += x;
        root = merge(pair1.first, pair1.second);
        root = merge(root, pair.second);
    }

    void erase(ll x){
        pii pair = split(root, x);
        pii pair1 = split(pair.first, x - 1);
        if (!pair1.second || cnt[pair1.second] == 1){
            root = merge(pair1.first, pair.second);
            return;
        }
        -- cnt[pair1.second], -- sz[pair1.second];
        sum[pair1.second] -= x;
        root = merge(pair1.first, pair1.second);
        root = merge(root, pair.second);
    }

    ll prev(int u, ll x){
        if (!u) return LLONG_MIN;
        if (x <= key[u]) return prev(ls(u), x);
        ll ret = prev(rs(u), x);
        return ret == LLONG_MIN ? key[u] : ret;
    }

    ll prev_non_strict(int u, ll x){
        if (!u) return LLONG_MIN;
        if (x < key[u]) return prev_non_strict(ls(u), x);
        if (x == key[u]) return x;
        ll ret = prev_non_strict(rs(u), x);
        return ret == LLONG_MIN ? key[u] : ret;
    }

    ll next(int u, ll x){
        if (!u) return LLONG_MAX;
        if (x >= key[u]) return next(rs(u), x);
        ll ret = next(ls(u), x);
        return ret == LLONG_MAX ? key[u] : ret;
    }

    ll get_sum(int u, ll x){
        if (!u) return 0;
        if (x > key[u]){
            return get_sum(rs(u), x);
        }
        return get_sum(ls(u), x) + cnt[u] * key[u] + sum[rs(u)];
    }

    ll get_cnt(int u, ll x){
        if (!u) return 0;
        if (x > key[u]){
            return get_cnt(rs(u), x);
        }
        return get_cnt(ls(u), x) + cnt[u] + sz[rs(u)];
    }
};

Treap treap1, treap2;
ll a[N], b[N];

int main(){
    int n, m, q;
    scanf("%d%d%d", &n, &m, &q);
    ll sum1 = 0, sum2 = 0;
    for (int i = 0; i < n; ++ i){
        scanf("%lld", &a[i]);
        treap1.insert(a[i]);
        sum1 += a[i];
    }
    for (int i = 0; i < m; ++ i){
        scanf("%lld", &b[i]);
        treap2.insert(b[i]);
        sum2 += b[i];
    }
    while (q --){
        int type;
        scanf("%d", &type);
        if (type == 1){
            int pos;
            ll x;
            scanf("%d%lld", &pos, &x);
            -- pos;
            sum1 -= a[pos];
            treap1.erase(a[pos]);
            a[pos] = x;
            treap1.insert(a[pos]);
            sum1 += a[pos];
            continue;
        }
        if (type == 2){
            int pos;
            ll x;
            scanf("%d%lld", &pos, &x);
            -- pos;
            sum2 -= b[pos];
            treap2.erase(b[pos]);
            b[pos] = x;
            treap2.insert(b[pos]);
            sum2 += b[pos];
            continue;
        }
        ll k;
        scanf("%lld", &k);
        ll min1 = treap1.begin(), min2 = treap2.begin();
        ll global_min = std::min(min1, min2);
        ll ans = LLONG_MIN;
        {
            ll x = global_min + k;
            ll u = treap1.prev_non_strict(treap1.root, x);
            if (u != LLONG_MIN){
                ll first = u - k;
                ll value = (sum1 - n * first) - (sum2 - m * first);
                ans = std::max(ans, value);
                first = min1 - k;
                value = (sum1 - n * first) - (sum2 - m * first);
                ans = std::max(ans, value);
            }
            u = treap2.prev_non_strict(treap2.root, x);
            if (u != LLONG_MIN){
                ll first = u - k;
                ll value = (sum1 - n * first) - (sum2 - m * first);
                ans = std::max(ans, value);
                first = min2 - k;
                value = (sum1 - n * first) - (sum2 - m * first);
                ans = std::max(ans, value);
            }
        }
        {
            ll x = global_min + k;
            ll u = treap2.next(treap2.root, x);
            if (u != LLONG_MAX){
                ll first = treap2.end() - k;
                if (first > global_min){
                    ll value = sum1 - n * global_min;
                    ll sum = treap2.get_sum(treap2.root, first);
                    ll cnt = treap2.get_cnt(treap2.root, first);
                    value -= sum - cnt * first;
                    ans = std::max(ans, value);
                }
            }
        }
        {
            ll a1 = treap2.end() + k;
            ll first = treap1.next(treap1.root, a1);
            if (first != LLONG_MAX && first - k > global_min){
                ll value = sum1 - n * global_min;

                // fix first value
                value -= first - global_min;
                value += k;

                first -= k;
                ll sum = treap2.get_sum(treap2.root, first);
                ll cnt = treap2.get_cnt(treap2.root, first);
                value -= sum - cnt * first;
                ans = std::max(ans, value);
            }
            first = treap1.prev_non_strict(treap1.root, a1);
            if (first != LLONG_MIN && first - k > global_min){
                ll value = sum1 - n * global_min;

                // fix first value
                value -= first - global_min;
                value += k;

                first -= k;
                ll sum = treap2.get_sum(treap2.root, first);
                ll cnt = treap2.get_cnt(treap2.root, first);
                value -= sum - cnt * first;
                ans = std::max(ans, value);
            }
        }
        printf("%lld\n", ans);
    }
    return 0;
}

// #include <bits/stdc++.h>
//
// const int N = 20;
// int a[N], b[N];
//
// int main(){
//     std::mt19937 rnd(std::chrono::steady_clock::now().time_since_epoch().count());
//     int n, m;
//     scanf("%d%d", &n, &m);
//     printf("a = ");
//     for (int i = 0; i < n; ++ i){
//         a[i] = rnd() % 10;
//         // scanf("%d", &a[i]);
//         printf("%d ", a[i]);
//     }
//     puts("");
//     printf("b = ");
//     for (int i = 0; i < m; ++ i){
//         b[i] = rnd() % 10;
//         // scanf("%d", &b[i]);
//         printf("%d ", b[i]);
//     }
//     std::sort(a, a + n);
//     std::sort(b, b + m, std::greater <int>());
//     puts("");
//     std::vector <int> perm(n + m);
//     for (int i = 0; i < n + m; ++ i){
//         perm[i] = i;
//     }
//     const int MAX = 20;
//     std::vector <int> max(MAX, INT_MIN);
//     std::vector <std::vector <int>> pos(MAX);
//     do{
//         auto get = [&](int pos){
//             return pos < n ? b[pos] : a[pos - m];
//         };
//         for (int i = 0; i < MAX; ++ i){
//             int pre = get(perm[0]), cur = i;
//             int ans = 0;
//             for (int j = 0; j < n + m; ++ j){
//                 int x = get(perm[j]);
//                 cur = std::max(cur + x - pre, 0);
//                 ans += perm[j] < m ? -cur : cur;
//                 pre = x;
//             }
//             if (max[i] < ans){
//                 max[i] = ans;
//                 pos[i] = perm;
//             }
//             max[i] = std::max(max[i], ans);
//         }
//     }
//     while (std::next_permutation(perm.begin(), perm.end()));
//     for (int i = 0; i < MAX; ++ i){
//         printf("%d = %d: ", i, max[i]);
//         for (auto u : pos[i]){
//             printf("%d%c ", u < n ? b[u] : a[u - m], u < m ? 'b' : 'a');
//         }
//         puts("");
//     }
//     return 0;
// }