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:
/*
the vast starry sky,
bright for those who chase the light.
*/
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define mk make_pair
const int inf=(int)1e9;
const ll INF=(ll)5e18;
const int MOD=998244353;
int _abs(int x){return x<0 ? -x : x;}
int add(int x,int y){x+=y; return x>=MOD ? x-MOD : x;}
int sub(int x,int y){x-=y; return x<0 ? x+MOD : x;}
#define mul(x,y) (ll)(x)*(y)%MOD
void Add(int &x,int y){x+=y; if(x>=MOD) x-=MOD;}
void Sub(int &x,int y){x-=y; if(x<0) x+=MOD;}
void Mul(int &x,int y){x=mul(x,y);}
int qpow(int x,int y){int ret=1; while(y){if(y&1) ret=mul(ret,x); x=mul(x,x); y>>=1;} return ret;}
void checkmin(int &x,int y){if(x>y) x=y;}
void checkmax(int &x,int y){if(x<y) x=y;}
void checkmin(ll &x,ll y){if(x>y) x=y;}
void checkmax(ll &x,ll y){if(x<y) x=y;}
#define out(x) cerr<<#x<<'='<<x<<' '
#define outln(x) cerr<<#x<<'='<<x<<endl
#define sz(x) (int)(x).size()
inline int read(){
    int x=0,f=1; char c=getchar();
    while(c>'9'||c<'0'){if(c=='-') f=-1; c=getchar();}
    while(c>='0'&&c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar();
    return x*f;
}
const int N=200005;
const int M=1000001;
struct BIT{
    ll sum[M+5]; int num[M+5];
    int lowbit(int x){return x&(-x);}
    int find(int k){
        int x=0;
        for(int i=19;i>=0;i--){
            if(x+(1<<i)>M) continue;
            if(num[x+(1<<i)]<k) k-=num[x+(1<<i)],x+=(1<<i);
        }
        return x;
    }
    void update(int x,int val){
        x++;
        for(int i=x;i<=M;i+=lowbit(i)) sum[i]+=val*(x-1),num[i]+=val;
    }
    ll query(int x){
        x++; if(x>M) x=M;
        ll ret=0;
        for(int i=x;i;i-=lowbit(i)) ret+=sum[i];
        return ret;
    }
    int Count(int x){
        x++; if(x>M) x=M;
        int ret=0;
        for(int i=x;i;i-=lowbit(i)) ret+=num[i];
        return ret;
    }
}Ta,Tb;

int n,m,q,a[N],b[N],Min=inf; ll suma=0,sumb=0;
multiset<int> sta,stb;
void init(){
    n=read(); m=read(); q=read();
    for(int i=1;i<=n;i++) a[i]=read(),suma+=a[i],checkmin(Min,a[i]),sta.insert(a[i]);
    for(int i=1;i<=m;i++) b[i]=read(),sumb+=b[i],checkmin(Min,b[i]),stb.insert(b[i]);
    for(int i=1;i<=m;i++) Tb.update(b[i],1);
    for(int i=1;i<=n;i++) Ta.update(a[i],1);
}

ll calca(int k,int c1){
    ll ret=1ll*(m-n)*c1;
    ret+=1ll*(n-1)*max(c1-k-Min,0);
    if(c1-k>0){
        int num=Tb.Count(c1-k);
        ret+=Tb.query(c1-k);
        ret-=1ll*num*(c1-k);
    }
    return ret;
}
ll calcb(int k,int c1){
    ll ret=1ll*(m-n)*c1;
    ret+=1ll*n*max(c1-k-Min,0);
    if(c1-k>0){
        int num=Tb.Count(c1-k);
        ret+=Tb.query(c1-k);
        ret-=1ll*num*(c1-k);
    }
    return ret;
}
int tot=0;
void solve(int k){
    ll ans=suma-sumb+1ll*(n-m)*k;
    ll ret=-INF;
    int l=1,r=n;
    checkmax(ret,calca(k,Ta.find(l)));
    checkmax(ret,calca(k,Ta.find(r)));
    int pos=Ta.Count(k+Min);
    for(int i=-1;i<=1;i++){
        if(pos+i>=1&&pos+i<=n) 
            checkmax(ret,calca(k,Ta.find(pos+i)));
    }
    pos=Ta.Count(*stb.rbegin()+k);
    for(int i=-1;i<=1;i++){
        if(pos+i>=1&&pos+i<=n) 
            checkmax(ret,calca(k,Ta.find(pos+i)));
    }

    l=1,r=m;
    checkmax(ret,calcb(k,Tb.find(l)));
    checkmax(ret,calcb(k,Tb.find(r)));
    pos=Tb.Count(k+Min);
    for(int i=-1;i<=1;i++){
        if(pos+i>=1&&pos+i<=m) 
            checkmax(ret,calcb(k,Tb.find(pos+i)));
    }
    pos=Tb.Count(*stb.rbegin()+k);
    for(int i=-1;i<=1;i++){
        if(pos+i>=1&&pos+i<=m) 
            checkmax(ret,calcb(k,Tb.find(pos+i)));
    }
    printf("%lld\n",ret+ans);
}

signed main()
{
    init();
    while(q--){
        int opt=read();
        if(opt==1){
            int pos=read(),x=read();
            Ta.update(a[pos],-1); suma-=a[pos]; sta.erase(sta.lower_bound(a[pos]));
            a[pos]=x; 
            Ta.update(a[pos],1); suma+=a[pos]; sta.insert(a[pos]);
        }
        else if(opt==2){
            int pos=read(),x=read();
            Tb.update(b[pos],-1); sumb-=b[pos]; stb.erase(stb.lower_bound(b[pos]));
            b[pos]=x;
            Tb.update(b[pos],1); sumb+=b[pos]; stb.insert(b[pos]);
        }
        else{
            int x=read();
            solve(x);
        }
        Min=min(*stb.begin(),*sta.begin());
    }
    return 0;
}