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:
#define DEBUG 0

#include <bits/stdc++.h>
using namespace std;

#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(__i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}
#define print2dArr2(a,r,c,l) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<setw(l)<<setfill(' ')<<a[__i__][__j__]<<" ";}cout<<endl;}

// advanced debugging class
// debug 1,2,'A',"test";
class _Debug {
    public:
        template<typename T>
        _Debug& operator,(T val) {
            cout << val << endl;
            return *this;
        }
};
#define debug _Debug(),
#else
#define printLine(l)
#define printLine2(l,c)
#define printVar(n)
#define printArr(a,l)
#define print2dArr(a,r,c)
#define print2dArr2(a,r,c,l)
#define debug
#endif

// define
#define MAX_VAL 999999999
#define MAX_VAL_2 999999999999999999LL
#define EPS 1e-6
#define mp make_pair
#define pb push_back

// typedef
typedef unsigned int UI;
typedef long long int LLI;
typedef unsigned long long int ULLI;
typedef unsigned short int US;
typedef pair<int,int> pii;
typedef pair<LLI,LLI> plli;
typedef vector<int> vi;
typedef vector<LLI> vlli;
typedef vector<pii> vpii;
typedef vector<plli> vplli;

// ---------- END OF TEMPLATE ----------

int a[200000],b[200000];
struct data {
    LLI bit[1000005],bit2[1000005];
    multiset<int> S;
    int insert(int x) {
        int i;
        S.insert(x);
        for (i = x+1; i < 1000005; i += i & (-i)) bit[i]++,bit2[i] += x;
        return 0;
    }
    int erase(int x) {
        int i;
        S.erase(S.find(x));
        for (i = x+1; i < 1000005; i += i & (-i)) bit[i]--,bit2[i] -= x;
        return 0;
    }
    LLI query(int c) {
        int i;
        LLI s = 0,s2 = 0;
        for (i = 1000004; i > 0; i -= i & (-i)) s2 += bit2[i],s += bit[i];
        for (i = min(-c,1000004); i > 0; i -= i & (-i)) s2 -= bit2[i],s -= bit[i];
        return s2+c*s;
    }
};
data A,B;
int main() {
    int i;
    int n,m,q;
    int t,p,x;
    scanf("%d %d %d",&n,&m,&q);
    for (i = 0; i < n; i++) scanf("%d",&a[i]),B.insert(a[i]);
    for (i = 0; i < m; i++) scanf("%d",&b[i]),A.insert(b[i]);
    while (q--) {
        scanf("%d",&t);
        if (t == 1) {
            scanf("%d %d",&p,&x),p--;
            B.erase(a[p]);
            a[p] = x;
            B.insert(a[p]);
        }
        else if (t == 2) {
            scanf("%d %d",&p,&x),p--;
            A.erase(b[p]);
            b[p] = x;
            A.insert(b[p]);
        }
        else {
            scanf("%d",&x);

            LLI ans = -1e18;
            vpii cand;
            cand.pb(mp(*A.S.begin(),0));
            cand.pb(mp(*A.S.rbegin(),0));
            cand.pb(mp(*B.S.begin(),1));
            cand.pb(mp(*B.S.rbegin(),1));
            if (m > 1) {
                auto it = ++A.S.rbegin();
                auto it2 = B.S.lower_bound(*it+x);
                if (it2 != B.S.end()) cand.pb(mp(*it2,1));
                if (it2 != B.S.begin()) cand.pb(mp(*(--it2),1));
            }
            for (i = 0; i < cand.size(); i++) {
                LLI s = 0;
                if (cand[i].second == 0) {
                    A.erase(cand[i].first);
                    s = -A.query(x-cand[i].first)-x;
                    int y,l;
                    if (A.S.empty()) y = x,l = cand[i].first;
                    else y = max(*A.S.begin()+x-cand[i].first,0),l = *A.S.begin();
                    y = max(y+*B.S.begin()-l,0);
                    s += B.query(y-*B.S.begin());
                    A.insert(cand[i].first);
                }
                else {
                    B.erase(cand[i].first);
                    s = -A.query(x-cand[i].first),s += x;
                    int y,l;
                    if (A.S.empty()) y = x,l = cand[i].first;
                    else y = max(*A.S.begin()+x-cand[i].first,0),l = *A.S.begin();
                    if (!B.S.empty()) {
                        y = max(y+*B.S.begin()-l,0);
                        s += B.query(y-*B.S.begin());
                    }
                    B.insert(cand[i].first);
                }
                ans = max(ans,s);
            }
            printf("%lld\n",ans);
        }
    }

    return 0;
}