#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 100;
const int maxm = 100000 + 100;
int n, m;
int a[maxn];
int t[maxm], p[maxm], d[maxm];
int N;
int val[maxn + maxm];
int cnt[4 * (maxn + maxm)];
long long sum[4 * (maxn + maxm)], dis[4 * (maxn + maxm)];
void add(int x, int l, int r, int id, int v) {
  if (id < l || r <= id) return;
  cnt[x] += v;
  sum[x] += v * val[id];
  if (r - l == 1) return;
  int mid = (l + r) / 2;
  add(2 * x + 1, l, mid, id, v);
  add(2 * x + 2, mid, r, id, v);
  dis[x] = dis[2 * x + 1] + dis[2 * x + 2] + sum[2 * x + 2] * cnt[2 * x + 1] -
           sum[2 * x + 1] * cnt[2 * x + 2];
}
pair<long long, pair<int, long long> > ask(int x, int l, int r, int ql,
                                           int qr) {
  if (qr <= l || r <= ql)
    return pair<long long, pair<int, long long> >(0, make_pair(0, 0));
  if (ql <= l && r <= qr)
    return pair<long long, pair<int, long long> >(dis[x],
                                                  make_pair(cnt[x], sum[x]));
  int mid = (l + r) / 2;
  pair<long long, pair<int, long long> > A = ask(2 * x + 1, l, mid, ql, qr);
  pair<long long, pair<int, long long> > B = ask(2 * x + 2, mid, r, ql, qr);
  pair<long long, pair<int, long long> > ret =
      pair<long long, pair<int, long long> >(
          A.first + B.first + B.second.second * A.second.first -
              A.second.second * B.second.first,
          make_pair(A.second.first + B.second.first,
                    A.second.second + B.second.second));
  return pair<long long, pair<int, long long> >(
      A.first + B.first + B.second.second * A.second.first -
          A.second.second * B.second.first,
      make_pair(A.second.first + B.second.first,
                A.second.second + B.second.second));
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 0, _n = (int)(n); i < _n; i++) cin >> a[i], val[N++] = a[i];
  cin >> m;
  for (int i = 0, _n = (int)(m); i < _n; i++) {
    cin >> t[i] >> p[i] >> d[i];
    if (t[i] == 1) a[p[i] - 1] += d[i], val[N++] = a[p[i] - 1];
  }
  for (int i = 0, _n = (int)(m); i < _n; i++)
    if (t[i] == 1) a[p[i] - 1] -= d[i];
  sort(val, val + N);
  N = unique(val, val + N) - val;
  for (int i = 0, _n = (int)(n); i < _n; i++)
    add(0, 0, N, (lower_bound(val, val + N, a[i]) - val), 1);
  for (int i = 0, _n = (int)(m); i < _n; i++) {
    if (t[i] == 1) {
      add(0, 0, N, (lower_bound(val, val + N, a[p[i] - 1]) - val), -1);
      a[p[i] - 1] += d[i];
      add(0, 0, N, (lower_bound(val, val + N, a[p[i] - 1]) - val), 1);
    } else
      cout << ask(0, 0, N, (lower_bound(val, val + N, p[i]) - val),
                  (lower_bound(val, val + N, d[i] + 1) - val))
                  .first
           << endl;
  }
  {
    int _;
    cin >> _;
    return 0;
  }
}
