#include <bits/stdc++.h>
using namespace std;
struct node {
  int l, r;
  long long sum, dis, cnt;
};
const int MAXN = 1e5 + 10;
int n, m, a[MAXN], b[MAXN], Qt[MAXN];
unordered_map<long long, int> mp;
pair<int, int> Q[MAXN];
vector<long long> pos;
bool c[MAXN * 3];
node vs[(MAXN * 2) * 4];
long long merge(pair<long long, long long> a, pair<long long, long long> b) {
  return b.second * a.first - a.second * b.first;
}
void updv(int v) {
  vs[v].cnt = vs[2 * v].cnt + vs[2 * v + 1].cnt;
  vs[v].sum = vs[2 * v].sum + vs[2 * v + 1].sum;
  vs[v].dis = vs[2 * v].dis + vs[2 * v + 1].dis;
  vs[v].dis += merge({vs[2 * v].cnt, vs[2 * v].sum},
                     {vs[2 * v + 1].cnt, vs[2 * v + 1].sum});
}
void make(int v, int l, int r) {
  vs[v].l = l, vs[v].r = r;
  if (r - l == 1) {
    if (c[l]) {
      vs[v].cnt = 1;
      vs[v].sum = pos[l];
    }
    return;
  }
  int mid = (l + r) / 2;
  make(2 * v, l, mid);
  make(2 * v + 1, mid, r);
  updv(v);
}
void mdf(int v, int qi) {
  if (qi < vs[v].l || vs[v].r <= qi) return;
  if (vs[v].r - vs[v].l == 1) {
    if (c[qi]) {
      vs[v].cnt = 0;
      vs[v].sum = 0;
    } else {
      vs[v].cnt = 1;
      vs[v].sum = pos[qi];
    }
    c[qi] = !c[qi];
    return;
  }
  mdf(2 * v, qi);
  mdf(2 * v + 1, qi);
  updv(v);
}
pair<long long, pair<long long, long long> > getdis(int v, int ql, int qr) {
  if (qr <= vs[v].l || vs[v].r <= ql) return {0, {0, 0}};
  if (ql <= vs[v].l && vs[v].r <= qr)
    return {vs[v].cnt, {vs[v].sum, vs[v].dis}};
  pair<long long, pair<long long, long long> > aa, bb;
  aa = getdis(2 * v, ql, qr);
  bb = getdis(2 * v + 1, ql, qr);
  return {aa.first + bb.first,
          {aa.second.first + bb.second.first,
           merge({aa.first, aa.second.first}, {bb.first, bb.second.first}) +
               aa.second.second + bb.second.second}};
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i], b[i] = a[i], pos.push_back(a[i]);
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> Qt[i] >> Q[i].first >> Q[i].second;
    if (Qt[i] == 1)
      Q[i].first--;
    else
      Q[i].second++;
    if (Qt[i] == 1)
      b[Q[i].first] += Q[i].second, pos.push_back(b[Q[i].first]);
    else
      pos.push_back(Q[i].first), pos.push_back(Q[i].second);
  }
  sort(pos.begin(), pos.end());
  pos.resize(unique(pos.begin(), pos.end()) - pos.begin());
  for (int i = 0; i < pos.size(); i++) mp[pos[i]] = i;
  for (int i = 0; i < n; i++) c[mp[a[i]]] = 1;
  make(1, 0, pos.size());
  for (int i = 0; i < m; i++) {
    if (Qt[i] == 1) {
      mdf(1, mp[a[Q[i].first]]);
      a[Q[i].first] += Q[i].second;
      mdf(1, mp[a[Q[i].first]]);
    } else {
      pair<long long, pair<long long, long long> > res =
          getdis(1, mp[Q[i].first], mp[Q[i].second]);
      cout << res.second.second << '\n';
    }
  }
}
