#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 128;
template <class T>
struct segment {
  struct node {
    node *ch[2];
    T Ans, Sum;
    int l, r;
    int Size;
    int Mid() { return (r + l) >> 1; }
    node() {
      ch[0] = ch[1] = NULL;
      Ans = Sum = 0;
      l = r = Size = 0;
    }
    node(int l, int r) : l(l), r(r) {
      Ans = Sum = Size = 0;
      ch[0] = ch[1] = NULL;
    }
  } nodes[maxn << 2 + 1];
  int nodesize;
  node *top;
  node *build(int l, int r) {
    node *n = &nodes[nodesize++];
    *n = node(l, r);
    if (l == r) return n;
    int mid = (l + r) >> 1;
    n->ch[0] = build(l, mid);
    n->ch[1] = build(mid + 1, r);
    return n;
  }
  void update(node *p, node *l, node *r) {
    p->Size = l->Size + r->Size;
    p->Sum = l->Sum + r->Sum;
    p->Ans = l->Ans + r->Ans + l->Size * r->Sum - r->Size * l->Sum;
  }
  void add(int p, T v, int a, node *n) {
    if (n->l == n->r && n->l == p) {
      n->Sum += v;
      n->Size += a;
      return;
    }
    int mid = n->Mid();
    add(p, v, a, n->ch[p > mid]);
    update(n, n->ch[0], n->ch[1]);
  }
  node query(int l, int r, node *n) {
    node p(l, r);
    if (l == n->l && r == n->r) {
      p = *n;
      return p;
    }
    int mid = n->Mid();
    if (r <= mid) {
      return query(l, r, n->ch[0]);
    }
    if (l > mid) {
      return query(l, r, n->ch[1]);
    }
    node pl, pr;
    pl = query(l, mid, n->ch[0]);
    pr = query(mid + 1, r, n->ch[1]);
    update(&p, &pl, &pr);
    return p;
  }
};
segment<long long> S;
struct Q {
  int c, l, r;
} Qs[maxn * 2];
vector<long long> v;
int x[maxn], ox[maxn];
map<int, int> lc;
int main() {
  int n, m;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%d", x + i);
    v.push_back(x[i]);
    ox[i] = x[i];
  }
  cin >> m;
  int QC = 0;
  while (m--) {
    cin >> Qs[m].c >> Qs[m].l >> Qs[m].r;
    if (Qs[m].c == 1) {
      v.push_back(ox[Qs[m].l] + Qs[m].r);
      ox[Qs[m].l] += Qs[m].r;
    } else {
      v.push_back(Qs[m].l);
      v.push_back(Qs[m].r);
    }
    QC++;
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < v.size(); i++) {
    lc[v[i]] = i + 1;
  }
  S.top = S.build(1, v.size());
  for (int i = 1; i <= n; i++) {
    S.add(lc[x[i]], x[i], 1, S.top);
  }
  for (int i = QC - 1; i >= 0; i--) {
    if (Qs[i].c == 1) {
      S.add(lc[x[Qs[i].l]], -x[Qs[i].l], -1, S.top);
      S.add(lc[x[Qs[i].l] + Qs[i].r], x[Qs[i].l] + Qs[i].r, 1, S.top);
      x[Qs[i].l] += Qs[i].r;
    } else {
      cout << S.query(lc[Qs[i].l], lc[Qs[i].r], S.top).Ans << endl;
    }
  }
}
