#include <bits/stdc++.h>
using namespace std;
const int maxn = 2 * 100005;
const long long maxint = 1LL << 60;
struct tree {
  int l, r;
  long long sum;
  long long Sum;
  int cnt;
} g[4 * 3 * maxn];
struct node {
  int cnt;
  long long Sum, sum;
  node(int a, long long b, long long c) {
    cnt = a;
    sum = b;
    Sum = c;
  }
};
long long a[maxn], b[4 * maxn];
long long aa[maxn];
long long x[maxn], y[maxn], t[maxn];
int n, m;
void build(int l, int r, int t) {
  g[t].l = l;
  g[t].r = r;
  g[t].sum = 0;
  g[t].cnt = 0;
  g[t].Sum = 0;
  if (l == r) return;
  int mid = (l + r) / 2;
  build(l, mid, 2 * t);
  build(mid + 1, r, 2 * t + 1);
}
void Update(int t) {
  g[t].Sum = (g[2 * t].cnt > 1 ? g[2 * t].Sum : 0) +
             (g[2 * t + 1].cnt > 1 ? g[2 * t + 1].Sum : 0) +
             g[2 * t].cnt * g[2 * t + 1].sum - g[2 * t + 1].cnt * g[2 * t].sum;
  g[t].sum = g[2 * t].sum + g[2 * t + 1].sum;
  g[t].cnt = g[2 * t].cnt + g[2 * t + 1].cnt;
}
void update(int l, int r, int t, long long k) {
  if (g[t].l == l && g[t].r == r) {
    if (k == maxint) {
      g[t].sum = g[t].cnt = 0;
      g[t].Sum = 0;
      return;
    } else {
      g[t].sum = k;
      g[t].Sum = 0;
      g[t].cnt = 1;
      return;
    }
  }
  int mid = (g[t].l + g[t].r) / 2;
  if (l >= mid + 1)
    update(l, r, 2 * t + 1, k);
  else if (r <= mid)
    update(l, r, 2 * t, k);
  Update(t);
}
node find(int l, int r, int t) {
  if (g[t].l == l && g[t].r == r) {
    return node(g[t].cnt, g[t].sum, g[t].Sum);
  }
  int mid = (g[t].l + g[t].r) / 2;
  if (l >= mid + 1)
    return find(l, r, 2 * t + 1);
  else if (r <= mid)
    return find(l, r, 2 * t);
  else {
    node s1 = find(l, mid, 2 * t), s2 = find(mid + 1, r, 2 * t + 1);
    int cnt1 = s1.cnt, cnt2 = s2.cnt;
    long long sum1 = s1.sum, sum2 = s2.sum;
    long long Sum = (cnt1 > 1 ? s1.Sum : 0) + (cnt2 > 1 ? s2.Sum : 0) +
                    cnt1 * sum2 - cnt2 * sum1;
    return node(cnt1 + cnt2, sum1 + sum2, Sum);
  }
}
int main() {
  while (scanf("%d", &n) != EOF) {
    int l = 0;
    for (int i = 1; i <= n; i++) {
      scanf("%I64d", &a[i]);
      b[++l] = a[i];
      aa[i] = a[i];
    }
    scanf("%d", &m);
    for (int i = 1; i <= m; i++) {
      scanf("%I64d", &t[i]);
      if (t[i] == 1) {
        int p, d;
        scanf("%d%d", &p, &d);
        x[i] = aa[p];
        y[i] = aa[p] + d;
        aa[p] = y[i];
        b[++l] = x[i];
        b[++l] = y[i];
      } else {
        int ll, rr;
        scanf("%d%d", &ll, &rr);
        x[i] = ll;
        y[i] = rr;
        b[++l] = x[i];
        b[++l] = y[i];
      }
    }
    sort(b + 1, b + l + 1);
    int bn = unique(b + 1, b + l + 1) - &b[1];
    build(1, bn, 1);
    for (int i = 1; i <= n; i++) {
      int tmp = lower_bound(b + 1, b + bn + 1, a[i]) - &b[0];
      update(tmp, tmp, 1, a[i]);
    }
    for (int i = 1; i <= m; i++) {
      int l = lower_bound(b + 1, b + bn + 1, x[i]) - &b[0];
      int r = lower_bound(b + 1, b + bn + 1, y[i]) - &b[0];
      if (t[i] == 1) {
        update(l, l, 1, maxint);
        update(r, r, 1, y[i]);
      } else {
        if (l > r)
          puts("0");
        else
          printf("%I64d\n", find(l, r, 1).Sum);
      }
    }
  }
  return 0;
}
