#include <bits/stdc++.h>
using namespace std;
map<int, int> id;
struct node {
  int cnt;
  long long sum1, sum2;
  node() {}
  node(int _cnt, long long _sum1, long long _sum2)
      : cnt(_cnt), sum1(_sum1), sum2(_sum2) {}
};
struct STree {
  vector<node> tree;
  int n;
  void init(int _n) { n = _n, tree.resize(4 * n, node(0, 0, 0)); }
  void update(int a, int x, int c) { update(a, x, c, 0, 0, n); }
  void update(int a, int x, int c, int k, int l, int r) {
    if (a == l && a + 1 == r) {
      tree[k] = node(c, x, 0);
    } else if (l <= a && a < r) {
      update(a, x, c, k * 2 + 1, l, (l + r) / 2);
      update(a, x, c, k * 2 + 2, (l + r) / 2, r);
      tree[k] = merge(tree[k * 2 + 1], tree[k * 2 + 2]);
    }
  }
  node find(int a, int b) { return find(a, b, 0, 0, n); }
  node find(int a, int b, int k, int l, int r) {
    if (b <= l || r <= a)
      return node(0, 0ll, 0ll);
    else if (a <= l && r <= b)
      return tree[k];
    else {
      node x = find(a, b, k * 2 + 1, l, (l + r) / 2);
      node y = find(a, b, k * 2 + 2, (l + r) / 2, r);
      return merge(x, y);
    }
  }
  node merge(const node &lft, const node &rht) {
    node ret;
    ret.cnt = lft.cnt + rht.cnt;
    ret.sum1 = lft.sum1 + rht.sum1;
    ret.sum2 = rht.sum1 * lft.cnt - lft.sum1 * rht.cnt + lft.sum2 + rht.sum2;
    return ret;
  }
} T;
vector<int> coord;
int n, m;
int X[100005], cur[100005];
int op[100005], from[100005], to[100005];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d", X + i), cur[i] = X[i];
  scanf("%d", &m);
  for (int i = 0; i < m; ++i) {
    scanf("%d%d%d", op + i, from + i, to + i);
    if (op[i] == 1) {
      int idx = from[i] - 1;
      from[i] = cur[idx];
      to[i] = from[i] + to[i];
      cur[idx] = to[i];
    }
  }
  for (int i = 0; i < n; ++i) coord.push_back(X[i]);
  for (int i = 0; i < m; ++i) coord.push_back(from[i]), coord.push_back(to[i]);
  coord.push_back(1 << 30);
  sort(coord.begin(), coord.end());
  coord.erase(unique(coord.begin(), coord.end()), coord.end());
  for (int i = 0; i < coord.size(); ++i) id[coord[i]] = i;
  T.init(coord.size() + 10);
  for (int i = 0; i < n; ++i) T.update(id[X[i]], X[i], 1);
  for (int z = 0; z < m; ++z) {
    if (op[z] == 1) {
      T.update(id[from[z]], 0, 0);
      T.update(id[to[z]], to[z], 1);
    } else {
      node q = T.find(id[from[z]], id[to[z]] + 1);
      printf("%I64d\n", q.sum2);
    }
  }
}
