#include <bits/stdc++.h>
using namespace std;
int read() {
  int res(0), sign(1);
  char c;
  while (1) {
    c = getchar();
    if ('0' <= c && c <= '9') {
      res = c - '0';
      break;
    } else if (c == '-') {
      sign = -1;
      break;
    }
  }
  while (1) {
    c = getchar();
    if ('0' <= c && c <= '9')
      res = res * 10 + c - '0';
    else
      break;
  }
  return res * sign;
}
class Node {
 public:
  Node *Left, *Right;
  long long Size, sum, s1, s2, x;
  int r;
  Node() {}
  Node(int a) {
    Size = 1;
    Left = Right = NULL;
    sum = s1 = s2 = x = a;
    r = rand() * rand();
  }
};
typedef Node *pNode;
pNode Root;
inline long long Sizeof(pNode p) { return p ? p->Size : 0; }
inline long long Sum(pNode p) { return p ? p->sum : 0; }
inline long long S1(pNode p) { return p ? p->s1 : 0; }
inline long long S2(pNode p) { return p ? p->s2 : 0; }
void update(pNode p) {
  p->Size = Sizeof(p->Left) + Sizeof(p->Right) + 1;
  p->sum = Sum(p->Left) + Sum(p->Right) + p->x;
  p->s1 = S1(p->Left) + S1(p->Right) +
          ((p->x) + Sum(p->Right)) * (Sizeof(p->Left) + 1);
  p->s2 = S2(p->Left) + S2(p->Right) +
          ((p->x) + Sum(p->Left)) * (Sizeof(p->Right) + 1);
}
void Merge(pNode &t, pNode L, pNode R) {
  if (L) update(L);
  if (R) update(R);
  if (!L) return void(t = R);
  if (!R) return void(t = L);
  if (L->r > R->r)
    Merge(L->Right, L->Right, R), t = L;
  else
    Merge(R->Left, L, R->Left), t = R;
  update(t);
}
void Split(pNode t, pNode &L, pNode &R, int x) {
  if (t == NULL) return void(L = R = NULL);
  update(t);
  int second = Sizeof(t->Left) + 1;
  if (second <= x)
    Split(t->Right, t->Right, R, x - second), L = t;
  else
    Split(t->Left, L, t->Left, x), R = t;
  update(t);
}
int find(pNode t, int x, bool k) {
  if (t == NULL) return 1;
  if (t->x == x) return Sizeof(t->Left) + 1 + k;
  if (t->x > x) return find(t->Left, x, k);
  return find(t->Right, x, k) + Sizeof(t->Left) + 1;
}
void print(pNode p) {
  if (p == NULL) return;
  print(p->Left);
  printf("%lld\n", p->x);
  print(p->Right);
}
int M, N;
long long A[100005], B[100005];
void solve() {
  srand(10);
  int a, b, i, k, x, y;
  N = read();
  for (i = 1; i <= N; i++) A[i] = B[i] = read();
  sort(B + 1, B + N + 1);
  for (i = 1; i <= N; i++) Merge(Root, Root, new Node(B[i]));
  pNode t1, t2, t3, t4;
  M = read();
  while (M--) {
    k = read();
    a = read();
    b = read();
    if (k == 1) {
      x = find(Root, A[a], 0);
      A[a] += b;
      Split(Root, t1, t2, x - 1);
      Split(t2, t3, t4, 1);
      Merge(Root, t1, t4);
      x = find(Root, A[a], 0);
      Split(Root, t1, t2, x - 1);
      Merge(t1, t1, new Node(A[a]));
      Merge(Root, t1, t2);
    } else {
      x = find(Root, a, 0);
      y = find(Root, b, 1) - 1;
      if (x >= y) {
        printf("0\n");
        continue;
      }
      Split(Root, t1, t2, x - 1);
      Split(t2, t3, t4, y - x + 1);
      printf("%lld\n", t3->s1 - t3->s2);
      Merge(t2, t3, t4);
      Merge(Root, t1, t2);
    }
  }
}
int main() {
  solve();
  return 0;
}
