#include using namespace std; void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } #include using namespace atcoder; struct S { long long sum; int size; }; S op(S a, S b) { return S{a.sum + b.sum, a.size + b.size}; } S e() { return S{0, 0}; } int main() { fast_io(); int n, q, l0; cin >> n >> q >> l0; segtree seg(200001); int cnt[200001] = {}; for (int i = 0; i < n; i++) { int a; cin >> a; cnt[a]++; } for (int i = 0; i < 200001; i++) { seg.set(i, S{1LL * i * cnt[i], cnt[i]}); } int q2_cnt = 0; for (; q--;) { int com; cin >> com; if (com == 1) { int l; cin >> l; cnt[l]++; seg.set(l, S{1LL * l * cnt[l], cnt[l]}); } if (com == 2) { q2_cnt++; int l, r; cin >> l >> r; auto ans = seg.prod(l, r + 1); cout << ans.size << " " << ans.sum << "\n"; } if (com == 3) { int m; cin >> m; } } if (q2_cnt == 0) { cout << "Not Found!" << endl; } }