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<cstdio>
#include<cstdlib>
#include<algorithm>
#include<queue>
using std::min;
using std::max;
using std::queue;
typedef long long ll;
const int ninf=0xc0c0c0c0,inf=0x3f3f3f3f;
const ll ninfll=0xc0c0c0c0c0c0c0c0,infll=0x3f3f3f3f3f3f3f3f;
inline int Rand(int l,int r)
{
	return (rand()<<16|rand()<<1|rand()>>14)%(r-l+1)+l;
}
struct phs
{
	static const int N=1e6+5;
	inline int Rand()
	{
		return rand()<<13^rand()>>2^rand();
	}
	int rt,tot;
	int key[N],prio[N],size[N];
	ll sum[N];
	int ch[N][2];
	queue<int> Q;
	inline int new_node(int k)
	{
		int x;
		if(!Q.empty())
			x=Q.front(),Q.pop();
		else
			x=++tot;
		key[x]=sum[x]=k;prio[x]=Rand();size[x]=1;
		ch[x][0]=ch[x][1]=0;return x;
	}
	inline void push_up(int x)
	{
		sum[x]=sum[ch[x][0]]+key[x]+sum[ch[x][1]];
		size[x]=size[ch[x][0]]+1+size[ch[x][1]];
		return;
	}
	void split(int z,int &x,int &y,int k)
	{
		if(!z)
			return x=y=0,void();
		if(key[z]<=k)
			x=z,split(ch[z][1],ch[z][1],y,k);
		else
			y=z,split(ch[z][0],x,ch[z][0],k);
		push_up(z);
		return;
	}
	void split_size(int z,int &x,int &y,int k)
	{
		if(!z)
			return x=y=0,void();
		if(size[ch[z][0]]+1<=k)
			x=z,split_size(ch[z][1],ch[z][1],y,k-size[ch[z][0]]-1);
		else
			y=z,split_size(ch[z][0],x,ch[z][0],k);
		push_up(z);
		return;
	}
	int merge(int x,int y)
	{
		if(!x||!y)
			return x+y;
		if(prio[x]<prio[y])
			return ch[x][1]=merge(ch[x][1],y),push_up(x),x;
		else
			return ch[y][0]=merge(x,ch[y][0]),push_up(y),y;
	}
	inline void insert(int k)
	{
		int x,y;
		split(rt,x,y,k);
		rt=merge(merge(x,new_node(k)),y);
		return;
	}
	inline void erase(int k)
	{
		int x,y,z,w;
		split(rt,x,y,k);
		split(x,z,w,k-1);
		Q.push(w);
		w=merge(ch[w][0],ch[w][1]);
		rt=merge(merge(z,w),y);
		return;
	}
	inline int pre(int k)
	{
		int res=ninf,x=rt;
		while(x)
			if(key[x]<k)
				res=max(res,key[x]),x=ch[x][1];
			else
				x=ch[x][0];
		return res;
	}
	inline int suc(int k)
	{
		int res=inf,x=rt;
		while(x)
			if(key[x]>k)
				res=min(res,key[x]),x=ch[x][0];
			else
				x=ch[x][1];
		return res;
	}
	inline int select(int k)
	{
		if(k<1||k>size[rt])
			return inf;
		int x=rt;
		while(x)
			if(size[ch[x][0]]+1<k)
				k-=size[ch[x][0]]+1,x=ch[x][1];
			else if(size[ch[x][0]]+1==k)
				return key[x];
			else
				x=ch[x][0];
	}
}A,B;
const int N=1e6+5;
int n,m,q;
int a[N],b[N];
inline ll runa(int k,int x)
{
	if(x==ninf||x==inf)
		return ninfll;
	int minv,r1,r2;
	ll res;
//	A.erase(x);
	minv=min(min(A.suc(ninf),B.suc(ninf)),x-k);
	B.split(B.rt,r1,r2,x-k);
	res=k+(A.sum[A.rt]-x)-(ll)(n-1)*minv-(B.sum[r2]-(ll)B.size[r2]*(x-k));
	B.rt=B.merge(r1,r2);
//	A.insert(x);
	return res;
}
inline ll epca(int k,int x)
{
	return max(runa(k,A.pre(x)),runa(k,A.suc(x-1)));
}
inline ll runb(int k,int x)
{
	if(x==ninf||x==inf)
		return ninfll;
	int minv,r1,r2;
	ll res;
//	B.erase(x);
	minv=min(min(A.suc(ninf),B.suc(ninf)),x-k);
	B.split(B.rt,r1,r2,x-k);
	res=A.sum[A.rt]-(ll)n*minv-((B.sum[r2]-x)-(ll)(B.size[r2]-1)*(x-k))-k;
	B.rt=B.merge(r1,r2);
//	B.insert(x);
	return res;
}
inline ll epcb(int k,int x)
{
	return max(runb(k,B.pre(x)),runb(k,B.suc(x-1)));
}
inline ll solve(int k)
{
	if(k==0)
		return epcb(k,inf);
	ll ans=ninfll;
	register int i;
	ans=max(ans,epca(k,ninf));
//	ans=max(ans,epca(k,B.select(m-n)+k));
	ans=max(ans,epca(k,B.select(m-n+1)+k));
//	ans=max(ans,epca(k,B.select(m-n+2)+k));
//	ans=max(ans,epca(k,B.select(m-1)+k));
	ans=max(ans,epca(k,B.select(m)+k));
	ans=max(ans,epca(k,inf));
	ans=max(ans,epcb(k,ninf));
//	ans=max(ans,epcb(k,B.select(m-n-1)+k));
	ans=max(ans,epcb(k,B.select(m-n)+k));
//	ans=max(ans,epcb(k,B.select(m-n+1)+k));
//	ans=max(ans,epcb(k,B.select(m-1)+k));
	ans=max(ans,epcb(k,B.select(m)+k));
	ans=max(ans,epcb(k,inf));
	return ans;
}
signed main()
{
//	freopen("test.out","w",stdout);
	int opt,pos,x;
	register int i;
	scanf("%d%d%d",&n,&m,&q);
//	n=200000;m=200000;q=500000;
	for(i=1;i<=n;i++)
	{
//		a[i]=Rand(0,1000000);
		scanf("%d",&a[i]);
		A.insert(a[i]);
	}
	for(i=1;i<=m;i++)
	{
//		b[i]=Rand(0,1000000);
		scanf("%d",&b[i]);
		B.insert(b[i]);
	}
	//scanf("%lld",&opt)
	//opt=Rand(1,3)
	while(q--)
		switch(scanf("%d",&opt),opt)
		{
			case 1:
//			pos=Rand(1,n);x=Rand(1,1000000);
			scanf("%d%d",&pos,&x);
			A.erase(a[pos]);A.insert(x);
			a[pos]=x;break;
			case 2:
//			pos=Rand(1,n);x=Rand(1,1000000);
			scanf("%d%d",&pos,&x);
			B.erase(b[pos]);B.insert(x);
			b[pos]=x;break;
			case 3:
			scanf("%d",&x);
//			x=Rand(1,1000000);
			printf("%lld\n",solve(x));
			break;
		}
	return 0;
}