#include <bits/stdc++.h>

#define rep(i, a, b) for (int i = (a); i <= int(b); i++)
#define per(i, a, b) for (int i = (a); i >= int(b); i--)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define il inline
#define ct template<class type>
#define clr(a, n) memset((a), 0, sizeof((a)[0]) * (n))
#define cpy(a, b, n) memcpy((b), (a), sizeof((a)[0]) * (n))

using namespace std;

typedef long long ll;
typedef double db;
typedef pair<int, int> pii;

ct il void cmax(type &x, type y) { x < y ? x = y : 0; }
ct il void cmin(type &x, type y) { x > y ? x = y : 0; }

const int maxn = 2e5 + 5, maxm = (1 << 20) + 5;

// ll query(int k) {
// 	ll dt = 0;
// 	int mn = inf;
// 	rep(i, 1, n) dt += a[i], mn = min(mn, a[i]);
// 	rep(i, 1, m) dt -= b[i], mn = min(mn, b[i]);
// 	ll res = -infl;
// 	rep(i, 1, n) {
// 		cmax(res, (k - a[i]) - ll(n - 1) * mn + F(a[i] - k));
// 		cmax(res, ll(n) * (k - a[i]) + F(a[i] - k));
// 	}
// 	rep(i, 1, m) {
// 		cmax(res, -ll(n) * mn + F(b[i] - k));
// 		cmax(res, ll(n) * (k - b[i]) + F(b[i] - k));
// 	}
// 	return dt + res;
// }

const int lim = 1 << 20, inf = 1e9;

const ll infl = 4e18;

int n, m, q, a[maxn], b[maxn], b0[maxm];

ll b1[maxm], dt;

set<pii> Sa, Sb;

void add(int x, int y) {
	for (int i = x + 1; i <= lim; i += i & -i) b0[i] += y, b1[i] += y * x;
}

void sum(int x, int &y0, ll &y1) {
	y0 = 0, y1 = 0;
	for (int i = x + 1; i; i ^= i & -i) y0 += b0[i], y1 += b1[i];
}

void insa(int x) {
	Sa.insert(pii(a[x], x)), dt += a[x];
}

void insb(int x) {
	Sb.insert(pii(b[x], x)), dt -= b[x];
	add(b[x], 1);
}

void rmva(int x) {
	Sa.erase(pii(a[x], x)), dt -= a[x];
}

void rmvb(int x) {
	Sb.erase(pii(b[x], x)), dt += b[x];
	add(b[x], -1);
}

int get(int k) {
	if (k <= 0) return -inf;
	if (k > m) return inf;
	int x = lim;
	per(i, 19, 0) {
		if (k <= b0[x - (1 << i)]) x -= 1 << i;
		else k -= b0[x - (1 << i)];
	}
	return x - 1;
}

ll F(int x) {
	int y0;
	ll y1;
	sum(max(x, -1), y0, y1);
	return y1 + ll(x) * (m - y0);
}

ll G(int k, int x) {
	return ll(k) * x + F(x);
}

ll query(int k) {
	ll ans = -infl;
	int mn = min(Sa.begin()->fi, Sb.begin()->fi);
	int ret = get(-n + m) + k;
	set<pii>::iterator it = Sa.lower_bound(pii(ret, 0));
	if (it != Sa.end()) cmax(ans, G(-n, it->fi - k));
	if (it != Sa.begin()) cmax(ans, G(-n, (--it)->fi - k));
	it = Sb.lower_bound(pii(ret, 0));
	if (it != Sb.end()) cmax(ans, G(-n, it->fi - k));
	if (it != Sb.begin()) cmax(ans, G(-n, (--it)->fi - k));
	ret = get(-1 + m) + k;
	it = Sa.lower_bound(pii(ret, 0));
	if (it != Sa.end()) cmax(ans, G(-1, it->fi - k) - ll(n - 1) * mn);
	if (it != Sa.begin()) cmax(ans, G(-1, (--it)->fi - k) - ll(n - 1) * mn);
	ret = get(m) + k;
	it = Sb.lower_bound(pii(ret, 0));
	if (it != Sb.end()) cmax(ans, G(0, it->fi - k) - ll(n) * mn);
	if (it != Sb.begin()) cmax(ans, G(0, (--it)->fi - k) - ll(n) * mn);
	return dt + ans;
}

int main() {
	scanf("%d %d %d", &n, &m, &q);
	rep(i, 1, n) {
		scanf("%d", &a[i]), insa(i);
	}
	rep(i, 1, m) {
		scanf("%d", &b[i]), insb(i);
	}
	for (int op, x, y; q --> 0; ) {
		scanf("%d %d", &op, &x);
		if (op <= 2) {
			scanf("%d", &y);
			if (op == 1) {
				rmva(x), a[x] = y, insa(x);
			} else {
				rmvb(x), b[x] = y, insb(x);
			}
		} else {
			printf("%lld\n", query(x));
		}
	}
	return 0;
}