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 <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <cstring>
#include <list>  
#include <cassert>
#include <climits>
#include <bitset>
#include <chrono>
#include <random>
using namespace std;

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
std::mt19937 rnd((int)std::chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }

const int MAXN = 200000;
const int MAXQ = 500000;

// ascore: if x<=lo+k: asum+(k-x)*acnt
// ascore: if x>=lo+k: asum-lo*acnt (if x is from a: ascore decreases by x-lo-k)
// bscore: considering only bi>=x-k: bsum+(k-x)*bcnt

// conclusion1: if x<=lo+k, increasing x results in a gain of dx*(bcnt-acnt), so take highest if bcnt>acnt and lowest otherwise
// conclusion2: if x>=lo+k, increasing x results in a gain of dx*(bcnt-I[x is from a]), so if either take lowest x>=bhi+k or highest x<=bhi+k

int na, nb, nq;
int sa[MAXN];
int sb[MAXN];
int qkind[MAXQ], qidx[MAXQ], qval[MAXQ]; ll qans[MAXQ];

int ca[MAXN];
int cb[MAXN];

int cbfrom[MAXN];
vector<pair<int, int>> blst;
vector<pair<int, ll>> bit;

void bmod(pair<int, int> key, int by) {
	int idx = lower_bound(blst.begin(), blst.end(), key) - blst.begin(); assert(idx != SZ(blst) && blst[idx] == key);
	++idx; while (idx <= SZ(blst)) { bit[idx].first += by, bit[idx].second += by * key.first; idx += idx & -idx; }
}
pair<int, ll> bget(int idx) {
	++idx; pair<int, ll> ret = MP(0, 0LL); while (idx > 0) { ret.first += bit[idx].first; ret.second += bit[idx].second; idx -= idx & -idx; } return ret;
}

void solve() {
	blst.clear();
	REP(i, nb) blst.PB(MP(sb[i], i));
	REP(i, nq) if (qkind[i] == 2) blst.PB(MP(qval[i], nb + i));
	sort(blst.begin(), blst.end());
	bit = vector<pair<int, ll>>(SZ(blst) + 1, MP(0, 0LL));


	ll asum = 0, bsum = 0;
	multiset<int> aset;
	multiset<int> bset;
	REP(i, na) ca[i] = sa[i], asum += ca[i], aset.insert(ca[i]);
	REP(i, nb) cb[i] = sb[i], bsum += cb[i], cbfrom[i] = i, bset.insert(cb[i]), bmod(MP(cb[i], i), +1);
	REP(i, nq) {
		if (qkind[i] == 1) {
			asum -= ca[qidx[i]], aset.erase(aset.find(ca[qidx[i]]));
			asum += qval[i], aset.insert(qval[i]);
			ca[qidx[i]] = qval[i];
		}
		if (qkind[i] == 2) {
			bsum -= cb[qidx[i]], bset.erase(bset.find(cb[qidx[i]])), bmod(MP(cb[qidx[i]], cbfrom[qidx[i]]), -1);
			bsum += qval[i], bset.insert(qval[i]), bmod(MP(qval[i], nb + i), +1);
			cb[qidx[i]] = qval[i], cbfrom[qidx[i]] = nb + i;
		}
		if (qkind[i] == 3) {
			//printf("q%d\n", i);
			int k = qval[i];
			int lo = min(*aset.begin(), *bset.begin());
			int bhi = *bset.rbegin();
			auto eval = [&](int x, bool froma) {
				ll ascore = asum + (ll)max(k - x, -lo) * na;
				if (froma) ascore -= max(0, x - lo - k);
				int idx = lower_bound(blst.begin(), blst.end(), MP(x - k, -1)) - blst.begin();
				pair<int, ll> cur = bget(idx - 1);
				ll bscore = (bsum - cur.second) + (ll)(k - x) * (nb - cur.first);
				return ascore - bscore;
			};
			ll ans = LLONG_MIN;
			auto relax = [&](int x, bool froma) {
				if (x == INT_MIN || x == INT_MAX) return;
				ans = max(ans, eval(x, froma));
			};
			//for (auto it = aset.begin(); it != aset.end(); ++it) printf("%d: %lld\n", *it, eval(*it, true));
			//for (auto it = bset.begin(); it != bset.end(); ++it) printf("%d: %lld\n", *it, eval(*it, false));
			relax(*aset.begin(), true);
			relax(*aset.rbegin(), true);
			relax(*bset.begin(), false);
			relax(*bset.rbegin(), false);
			{ auto it = aset.lower_bound(bhi + k); if (it != aset.end()) relax(*it, true); }
			{ auto it = aset.lower_bound(bhi + k); if (it != aset.begin()) relax(*prev(it), true); }
			{ auto it = bset.lower_bound(bhi + k); if (it != aset.begin()) relax(*prev(it), false); }
			qans[i] = ans;
		}
	}
}

void solvestupid() {
	REP(i, na) ca[i] = sa[i];
	REP(i, nb) cb[i] = sb[i];
	REP(i, nq) {
		if (qkind[i] == 1) {
			ca[qidx[i]] = qval[i];
		}
		if (qkind[i] == 2) {
			cb[qidx[i]] = qval[i];
		}
		if (qkind[i] == 3) {
			printf("q%d\n", i);
			int k = qval[i];
			int lo = INT_MAX;
			REP(j, na) lo = min(lo, ca[j]);
			REP(j, nb) lo = min(lo, cb[j]);
			int bhi = INT_MIN;
			REP(j, nb) bhi = max(bhi, cb[j]);
			ll ans = LLONG_MIN;
			REP(rep, 3) {
				int x; bool dec = false;
				if (rep == 0) { // x<=lo+k
					if (nb > na) {
						x = INT_MIN;
						REP(j, na) if (ca[j] <= lo + k) x = max(x, ca[j]);
						REP(j, nb) if (cb[j] <= lo + k) x = max(x, cb[j]);
					} else {
						x = INT_MAX;
						REP(j, na) if (ca[j] <= lo + k) x = min(x, ca[j]);
						REP(j, nb) if (cb[j] <= lo + k) x = min(x, cb[j]);
					}
				}
				if (rep == 1) { // x>=lo+k, x>=bhi+k
					x = INT_MAX;
					REP(j, na) if (ca[j] >= bhi + k) x = min(x, ca[j]);
				}
				if (rep == 2) { // x>=lo+k, x<=bhi+k
					x = INT_MIN;
					REP(j, nb) if (cb[j] >= lo + k) x = max(x, cb[j]);
					REP(j, na) if (ca[j] >= lo + k && ca[j] <= bhi + k && ca[j] > x) x = ca[j], dec = true;
				}
				if (x != INT_MIN && x != INT_MAX) {
					ll ascore = 0, bscore = 0;
					REP(j, na) ascore += max(ca[j] + (k - x), ca[j] - lo);
					REP(j, nb) if (cb[j] >= x - k) bscore += cb[j] + (k - x);
					if (dec) ascore -= x - lo - k;
					printf("%d: x=%d%s lo=%d k=%d ascore=%lld bscore=%lld -> %lld\n", rep, x, dec ? "DEC" : "", lo, k, ascore, bscore, ascore - bscore);
					ans = max(ans, ascore - bscore);
				}
			}
			qans[i] = ans;
		}
	}
}

void run() {
	scanf("%d%d%d", &na, &nb, &nq);
	REP(i, na) scanf("%d", &sa[i]);
	REP(i, nb) scanf("%d", &sb[i]);
	REP(i, nq) { scanf("%d", &qkind[i]); if (qkind[i] == 1 || qkind[i] == 2) scanf("%d%d", &qidx[i], &qval[i]), --qidx[i]; if (qkind[i] == 3) scanf("%d", &qval[i]); }
	solve();
	REP(i, nq) if (qkind[i] == 3) printf("%lld\n", qans[i]);
}

int main() {
	run();
	return 0;
}