#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void in(T &x) {
  x = 0;
  char c = getchar();
  bool f = 0;
  while (!isdigit(c)) f |= (c == '-'), c = getchar();
  while (isdigit(c)) x = x * 10 + (c ^ '0'), c = getchar();
  f ? x = -x : 0;
}
template <class T>
inline void out(T x, const char c = '\n') {
  static short st[30];
  short m = 0;
  if (x < 0) putchar('-'), x = -x;
  do st[++m] = x % 10, x /= 10;
  while (x);
  while (m) putchar(st[m--] | '0');
  putchar(c);
}
template <class T>
inline void err(const T &x, const char c = '\n') {
  cerr << x << c;
}
template <class T, class... Args>
inline void in(T &x, Args &...args) {
  in(x);
  in(args...);
}
template <class T, class... Args>
inline void out(const T &x, const Args &...args) {
  out(x, ' ');
  out(args...);
}
template <class T, class... Args>
inline void err(const T &x, const Args &...args) {
  err(x, ' ');
  err(args...);
}
template <class T>
inline void prt(T a[], int n) {
  for (register int i = 0; i < n; ++i) out(a[i], i == n - 1 ? '\n' : ' ');
}
template <class T>
inline void clr(T a[], int n) {
  memset(a, 0, sizeof(T) * n);
}
template <class T>
inline void clr(T *a, T *b) {
  memset(a, 0, sizeof(T) * (b - a));
}
template <class T>
inline bool ckmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
template <class T>
inline bool ckmin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
namespace i207M {
const int len = 1.2e9;
int ch[100005 * 50][2], sz[100005 * 50], tot;
long long sum[100005 * 50], val[100005 * 50][2];
inline void clr(int x) { sz[x] = 0, sum[x] = val[x][0] = val[x][1] = 0; }
inline void up(int x, int lson, int rson) {
  sz[x] = sz[lson] + sz[rson];
  sum[x] = sum[lson] + sum[rson];
  val[x][0] = val[rson][0] + sum[rson] * sz[lson] + val[lson][0];
  val[x][1] = val[lson][1] + sum[lson] * sz[rson] + val[rson][1];
}
void ins(int &x, int l, int r, int p, int k) {
  if (!x) x = ++tot;
  if (l == r) {
    sz[x] += k, sum[x] += p * k;
    return;
  }
  int mid = l + ((long long)r - l) / 2;
  if (p <= mid)
    ins(ch[x][0], l, mid, p, k);
  else
    ins(ch[x][1], mid + 1, r, p, k);
  up(x, ch[x][0], ch[x][1]);
}
void ask(int x, int l, int r, int ql, int qr) {
  if (ql <= l && r <= qr) {
    up(100005 * 50 - 1, 100005 * 50 - 1, x);
    return;
  }
  int mid = l + ((long long)r - l) / 2;
  if (ql <= mid) ask(ch[x][0], l, mid, ql, qr);
  if (qr > mid) ask(ch[x][1], mid + 1, r, ql, qr);
}
int rt;
int pos[100005];
signed main() {
  int cq, op, a, b;
  in(cq);
  for (register int i = 1; i <= cq; ++i)
    in(pos[i]), ins(rt, -len, len, pos[i], 1);
  in(cq);
  while (cq--) {
    in(op, a, b);
    if (op == 1) {
      ins(rt, -len, len, pos[a], -1);
      ins(rt, -len, len, pos[a] += b, 1);
    } else {
      clr(100005 * 50 - 1);
      ask(rt, -len, len, a, b);
      out(val[100005 * 50 - 1][0] - val[100005 * 50 - 1][1]);
    }
  }
  return 0;
}
}  // namespace i207M
signed main() {
  i207M::main();
  return 0;
}
