#include<bits/stdc++.h>
#define cs const
#define pb push_back
using namespace std;

typedef long long ll;
cs int N = 2e5 + 50, M = 1e6 + 50;

int n, m, q, a[N], b[N];
ll A, B, k;
multiset<int> Sa, Sb;
typedef multiset<int> :: iterator It;
struct bit{
	ll c[M]; 
	void add(int x, int v){ ++x; for(; x <= 1e6 + 1; x += x & -x) c[x] += v; }
	ll ask(int x){ ll s = 0; ++x; for(; x; x -= x & -x) s += c[x]; return s; }
	ll qry(int l, int r){ return ask(r) - ask(l - 1); }
} T[2];

ll F(ll t){ return t * T[0].qry(0, t) - T[1].qry(1, t); }
ll calc(int o, int t){
	ll c = 1ll * (k - t) * (n - m) + A - B;
	ll mn = min(*Sa.begin(), *Sb.begin());
	if(t - mn - k <= 0) return c; 
	return c + 1ll * (n - (!o)) * (t - mn - k) - F(t - k);
}

int main(){
	#ifdef FSYo
	freopen("1.in", "r", stdin);
	#endif
	cin >> n >> m >> q; 
	for(int i = 1; i <= n; i++)
		scanf("%d", &a[i]), 
		A += a[i], Sa.insert(a[i]);
	for(int i = 1; i <= m; i++)
		scanf("%d", &b[i]), 
		B += b[i], Sb.insert(b[i]);
	for(int i = 1; i <= m; i++)
		T[0].add(b[i], 1), T[1].add(b[i], b[i]);
	while(q--){
		int o, x, w; scanf("%d%d", &o, &x);
		if(o == 1){
			scanf("%d", &w);
			Sa.erase(Sa.find(a[x]));
			A += w - a[x];
			Sa.insert(a[x] = w);
		} 
		if(o == 2){
			scanf("%d", &w);
			Sb.erase(Sb.find(b[x]));
			B += w - b[x];
			T[0].add(b[x], -1), T[1].add(b[x], -b[x]);
			Sb.insert(b[x] = w);
			T[0].add(w, 1), T[1].add(w, w);
		}
		if(o == 3){
			k = x; 
			It ma = Sa.begin(), mb = Sb.begin();
			int mn = min(*ma, *mb);
			ll ans = calc(0, mn);
			It p = Sa.lower_bound(mn + k);
			It q = Sb.lower_bound(mn + k);
			if(p != Sa.begin()) ans = max(ans, calc(0, *(--p)));
			if(q != Sb.begin()) ans = max(ans, calc(1, *(--q)));
			It xa = --Sa.end(), xb = --Sb.end();
			ans = max(ans, calc(0, *xa));
			ans = max(ans, calc(1, *xb));
			It z = Sa.lower_bound(k + *xb);
			if(z != Sa.end()) ans = max(ans, calc(0, *z));
			if(z != Sa.begin()) --z, ans = max(ans, calc(0, *z));
			cout << ans << '\n';
		}
	} return 0; 
}