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<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<set>
#define ll long long
#define inf 1000000
#define ninf 0x8080808080808080LL
#define pil pair<int,ll>
#define fi first
#define se second
using namespace std;
int n,m,q;
ll sma,smb;
int as[200009],bs[200009];
multiset<int> st,sa;
int ct[4000009];
ll sm[4000009];
pil operator+(pil a,pil b){return pil(a.fi+b.fi,a.se+b.se);}
void add(int a,int l,int r,int p,int v)
{
	ct[a]+=v,sm[a]+=v*p;
	if(l==r)
		return;
	int mid=(l+r)>>1;
	if(p<=mid)
		add(a<<1,l,mid,p,v);
	else
		add(a<<1|1,mid+1,r,p,v);
	// ct[a]=ct[a<<1]+ct[a<<1|1];
	// sm[a]=sm[a<<1]+sm[a<<1|1];
}
int kth(int a,int l,int r,int k)
{
	if(l==r)
		return l;
	int mid=(l+r)>>1;
	if(k<=ct[a<<1])
		return kth(a<<1,l,mid,k);
	return kth(a<<1|1,mid+1,r,k-ct[a<<1]);
}
int rnk(int a,int l,int r,int v)
{
	if(l==r)
		return 1;
	int mid=(l+r)>>1;
	if(v<=mid)
		return rnk(a<<1,l,mid,v);
	return rnk(a<<1|1,mid+1,r,v)+ct[a<<1];
}
pil getsm(int a,int l,int r,int ql,int qr)
{
	if(ql>qr||l>qr||r<ql)
		return pil(0,0);
	if(l>=ql&&r<=qr)
		return pil(ct[a],sm[a]);
	int mid=(l+r)>>1;
	return getsm(a<<1,l,mid,ql,qr)+getsm(a<<1|1,mid+1,r,ql,qr);
}
ll gsma(int t,int k,int mn)
{
	ll sm=(ll)(m-n)*(t-k)+(ll)(n-1)*max(0,t-k-mn);
	pil pp=getsm(1,0,inf,0,t-k);
	sm-=(ll)(t-k)*pp.fi-pp.se;
	return sm;
}
ll gsmb(int t,int k,int mn)
{
	ll sm=(ll)(m-n)*(t-k)+(ll)n*max(0,t-k-mn);
	pil pp=getsm(1,0,inf,0,t-k);
	sm-=(ll)(t-k)*pp.fi-pp.se;
	return sm;
}
ll cala(int k)
{
	ll ans=ninf;
	int mn=*st.begin();
	if(m<n)
	{
		int t=*sa.begin();
		ans=max(ans,gsma(t,k,mn));
	}
	int bd=0;
	if(m==1)
		bd=mn+k;
	else
		bd=kth(1,0,inf,m-1)+k;
	// printf("bd:%d\n",bd);
	// printf("ct2:%d sm2:%lld\n",ct[2],sm[2]);
	// for(int i=1;i<=m;i++)
	// 	printf("i:%d kth:%d\n",i,kth(1,0,inf,i));
	auto it=sa.lower_bound(bd);
	if(it!=sa.end())
	{
		// printf("qwq\n");
		int t=*it;
		// printf("t:%d\n",t);
		ans=max(ans,gsma(t,k,mn));
	}
	if(it!=sa.begin())
	{
		it--;
		int t=*it;
		// printf("t:%d\n",t);
		// printf("pwp %d\n",t);
		ans=max(ans,gsma(t,k,mn));
	}
	// printf("cala:%lld\n",ans);
	return ans;
}
ll calb(int k)
{
	ll ans=ninf;
	int mn=*st.begin();
	if(m<n)
	{
		int t=kth(1,0,inf,1);
		ans=max(ans,gsmb(t,k,mn));
	}
	int t=kth(1,0,inf,m);
	ans=max(ans,gsmb(t,k,mn));
	// printf("calb:%lld\n",ans);
	return ans;
}
int main()
{
	scanf("%d%d%d",&n,&m,&q);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",as+i);
		sma+=as[i];
		st.insert(as[i]);
		sa.insert(as[i]);
	}
	for(int i=1;i<=m;i++)
	{
		scanf("%d",bs+i);
		smb+=bs[i];
		st.insert(bs[i]);
		add(1,0,inf,bs[i],1);
	}
	for(int i=1,a,b,c;i<=q;i++)
	{
		scanf("%d%d",&a,&b);
		if(a==1)
		{
			scanf("%d",&c);
			st.erase(st.find(as[b]));
			st.insert(c);
			sa.erase(sa.find(as[b]));
			sa.insert(c);
			sma-=as[b];
			sma+=c;
			as[b]=c;
		}
		else if(a==2)
		{
			scanf("%d",&c);
			st.erase(st.find(bs[b]));
			st.insert(c);
			add(1,0,inf,bs[b],-1);
			add(1,0,inf,c,1);
			smb-=bs[b];
			smb+=c;
			bs[b]=c;
		}
		else
		{
			ll ans=max(cala(b),calb(b));
			// if(ans+sma-smb==-327268)
			// {
			// 	printf("k:%d\n",b);
			// 	for(int i=1;i<=n;i++)
			// 		printf("%d ",as[i]);
			// 	printf("\n");
			// 	for(int i=1;i<=m;i++)
			// 		printf("%d ",bs[i]);
			// }
			// if(n!=20||m!=20)
			printf("%lld\n",ans+sma-smb);
		}
	}
	return 0;
}