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>

#define pb push_back
#define mp make_pair
#define fi first
#define se second

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

template <typename T> bool chkmax(T &x,T y){return x<y?x=y,true:false;}
template <typename T> bool chkmin(T &x,T y){return x>y?x=y,true:false;}

int readint(){
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

const int N=1000001;

struct bit{
	ll c[1000005];
	void add(int x,ll v){x++; for(;x<=N;x+=(x&(-x))) c[x]+=v;}
	ll ask(int x){ll ret=0; for(;x;x-=(x&(-x))) ret+=c[x]; return ret;}
	ll query(int l,int r){
		l++; r++;
		chkmax(l,1); chkmin(r,N);
		return ask(r)-ask(l-1);
	}
}T[2];

ll n,m,q,k;
ll a[200005],b[200005],sum[2];
multiset<int> s[2];

ll calc(ll x){
	return T[1].query(x,N)-x*T[0].query(x,N);
}

ll getans(ll tp,ll x){
	ll mina=min(*s[0].begin(),*s[1].begin());
	if(x>k+mina){
		if(tp==1) return sum[0]-n*mina-calc(x-k);
		else return sum[0]-n*mina+(k+mina-x)-calc(x-k);
	}
	else return (k-x)*(n-m)+sum[0]-sum[1];
}

int main(){
	n=readint(); m=readint(); q=readint();
	for(int i=1;i<=n;i++) a[i]=readint();
	for(int i=1;i<=m;i++) b[i]=readint();
	for(int i=1;i<=n;i++) s[0].insert(a[i]);
	for(int i=1;i<=m;i++) s[1].insert(b[i]);
	for(int i=1;i<=n;i++) sum[0]+=a[i];
	for(int i=1;i<=m;i++) sum[1]+=b[i];
	for(int i=1;i<=m;i++) T[0].add(b[i],1),T[1].add(b[i],b[i]);
	int opt,x,y;
	while(q--){
		opt=readint(); x=readint();
		if(opt==1){
			y=readint();
			s[0].erase(s[0].find(a[x]));
			s[0].insert(y);
			sum[0]-=a[x],sum[0]+=y;
			a[x]=y;
		}
		else if(opt==2){
			y=readint();
			s[1].erase(s[1].find(b[x]));
			s[1].insert(y);
			sum[1]-=b[x],sum[1]+=y;
			T[0].add(b[x],-1),T[1].add(b[x],-b[x]);
			b[x]=y;
			T[0].add(b[x],1),T[1].add(b[x],b[x]);
		}
		else{
			k=x;
			ll mina=min(*s[0].begin(),*s[1].begin()),ans=getans(0,mina);
			auto it0=s[0].upper_bound(k+mina),it1=s[1].upper_bound(k+mina);
			ll val0=0,val1=0;
			if(it0!=s[0].begin()) val0=*(--it0);
			if(it1!=s[1].begin()) val1=*(--it1);
			if(val0>val1) chkmax(ans,getans(0,val0));
			else chkmax(ans,getans(0,val1));
			
			int max0=*(--s[0].end()),max1=*(--s[1].end());
			if(max1>k+mina) chkmax(ans,getans(1,max1));
			if(max0>k+mina&&k-max0+max1>=0) chkmax(ans,getans(0,max0));
			else{
				auto it=s[0].lower_bound(k+max1);
				if(it!=s[0].end()) chkmax(ans,getans(0,*it));
				if(it!=s[0].begin()){
					it--;
					chkmax(ans,getans(0,*it));
				}
			}
			printf("%lld\n",ans);
		}
	}
	return 0;
}