#include using namespace std; using ll = int64_t; ll N, K, Q; vector A; void input() { ios::sync_with_stdio(false); cin.tie(nullptr); cin >> N >> K >> Q; A.resize(N); for (ll i=0; i> A[i]; } void solve() { priority_queue small; priority_queue, greater> large; sort(A.begin(), A.end()); for (ll i=0; i> q; if (q == 1) { ll x; cin >> x; if (x < kth) { small.pop(); small.push(x); large.push(kth); } else { large.push(x); } } else if (q == 2) { ll y; cin >> y; small.pop(); large.push(kth + y); kth = large.top(); large.pop(); small.push(kth); } else { cout << kth << "\n"; } } } int main() { input(); solve(); return 0; }