#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 10;
const long long INF = 2e9;
struct node {
  long long l, r;
  node *left_child, *right_child;
  long long cnt, rev, val;
  long long size() { return r - l; }
  long long unity(long long _l, long long _r) {
    return max(0LL, min(_r, r) - max(_l, l));
  }
  void build_childs() {
    long long med = (l + r) / 2;
    if (left_child == NULL) left_child = new node(l, med);
    if (right_child == NULL) right_child = new node(med, r);
  }
  void update() {
    node res = left_child->merge(right_child);
    val = res.val;
    rev = res.rev;
    cnt = res.cnt;
  }
  node merge(node *x) {
    node res = node();
    res.cnt = cnt + (x->cnt);
    res.rev = rev + (x->rev);
    res.val = val + (x->val) + (cnt * (x->rev)) - (rev * (x->cnt));
    return res;
  }
  node get(long long l, long long r) {
    if (unity(l, r) == 0) return node();
    if (unity(l, r) == size()) return *this;
    node v1;
    node v2;
    if (left_child != NULL) v1 = left_child->get(l, r);
    if (right_child != NULL) v2 = right_child->get(l, r);
    return v1.merge(&v2);
  }
  void put(bool job, long long pos) {
    if (size() == 1) {
      if (job) {
        cnt = 1;
        rev = pos;
        val = 0;
      } else
        cnt = rev = val = 0;
      return;
    }
    build_childs();
    long long med = (l + r) / 2;
    if (pos < med)
      left_child->put(job, pos);
    else
      right_child->put(job, pos);
    update();
  }
  node(long long _l = -1, long long _r = -1, long long _cnt = 0,
       long long _rev = 0, long long _val = 0) {
    l = _l;
    r = _r;
    left_child = right_child = NULL;
    cnt = _cnt;
    rev = _rev;
    val = _val;
  }
} * seg;
long long pos[N];
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  seg = new node(-INF, INF);
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> pos[i];
    seg->put(1, pos[i]);
  }
  long long q;
  cin >> q;
  for (long long i = 0; i < q; i++) {
    long long type;
    cin >> type;
    if (type == 1) {
      long long dir, point;
      cin >> point >> dir;
      point--;
      seg->put(0, pos[point]);
      pos[point] += dir;
      seg->put(1, pos[point]);
    } else {
      long long l, r;
      cin >> l >> r;
      cout << seg->get(l, r + 1).val << endl;
    }
  }
}
