/**
 ____ ____ ____ ____ ____
||a |||t |||o |||d |||o ||
||__|||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|/__\|

**/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int NM_MAX = 200002;
const int AB_MAX = 1000003;

const int BITS = 20;

const int AB = 1000000;

int n, m, q;

int a[NM_MAX];
int b[NM_MAX];

ll BITSumA[AB_MAX];
ll BITSumB[AB_MAX];

ll BITCntA[AB_MAX];
ll BITCntB[AB_MAX];

void update (ll BIT[], int pos, int val)
{
    pos++;
    for(int i = pos; i <= AB + 1; i += i & -i)
        BIT[i] += val;
}

ll query (ll BIT[], int pos)
{
    pos++;
    ll ans = 0;
    for(int i = pos; i >= 1; i -= i & -i)
        ans += BIT[i];
    return ans;
}

ll sumA, sumB;

multiset <int> sa, sb;

int mins (multiset <int> &s)
{
    return *s.begin();
}

int maxs (multiset <int> &s)
{
    return *s.rbegin();
}

ll fa (int k, int t)
{
    ll ans = 0;
    ans += 1LL * (k - t) * (n - m);
    ans += sumA - sumB;
    ans += 1LL * (n - 1) * max(0, t - k - min(mins(sa), mins(sb)));
    ll sumLess = query(BITSumB, t - k);
    int cntLess = query(BITCntB, t - k);
    ans -= 1LL * (t - k) * cntLess - sumLess;
    return ans;
}

ll fb (int k, int t)
{
    ll ans = 0;
    ans += 1LL * (k - t) * (n - m);
    ans += sumA - sumB;
    ans += 1LL * n * max(0, t - k - min(mins(sa), mins(sb)));
    ll sumLess = query(BITSumB, t - k);
    int cntLess = query(BITCntB, t - k);
    ans -= 1LL * (t - k) * cntLess - sumLess;
    return ans;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m >> q;
    for(int i = 1; i <= n; i++)
        cin >> a[i];
    for(int i = 1; i <= m; i++)
        cin >> b[i];
    for(int i = 1; i <= n; i++)
    {
        update(BITSumA, a[i], +a[i]);
        update(BITCntA, a[i], +1);
        sumA += a[i];
        sa.insert(a[i]);
    }
    for(int i = 1; i <= m; i++)
    {
        update(BITSumB, b[i], +b[i]);
        update(BITCntB, b[i], +1);
        sumB += b[i];
        sb.insert(b[i]);
    }
    while(q--)
    {
        int op;
        cin >> op;
        if(op == 1)
        {
            int pos, val;
            cin >> pos >> val;
            update(BITSumA, a[pos], -a[pos]);
            update(BITCntA, a[pos], -1);
            sumA -= a[pos];
            sa.erase(sa.find(a[pos]));
            a[pos] = val;
            update(BITSumA, a[pos], +a[pos]);
            update(BITCntA, a[pos], +1);
            sumA += a[pos];
            sa.insert(a[pos]);
        }
        else if(op == 2)
        {
            int pos, val;
            cin >> pos >> val;
            update(BITSumB, b[pos], -b[pos]);
            update(BITCntB, b[pos], -1);
            sumB -= b[pos];
            sb.erase(sb.find(b[pos]));
            b[pos] = val;
            update(BITSumB, b[pos], +b[pos]);
            update(BITCntB, b[pos], +1);
            sumB += b[pos];
            sb.insert(b[pos]);
        }
        else
        {
            int k;
            cin >> k;
            ll ans = LLONG_MIN;
            ans = max(ans, fa(k, *sa.rbegin()));
            ans = max(ans, fb(k, *sb.rbegin()));
            ans = max(ans, fa(k, *sa.begin()));
            ans = max(ans, fb(k, *sb.begin()));
            multiset <int> :: iterator it = sa.lower_bound(*sb.rbegin() + k);
            if(it != sa.end())
                ans = max(ans, fa(k, *it));
            if(it != sa.begin())
                ans = max(ans, fa(k, *prev(it)));
            cout << ans << "\n";
        }
    }
    return 0;
}
