Yaroslav has n points that lie on the Ox axis. The coordinate of the first point is x1, the coordinate of the second point is x2, ..., the coordinate of the n-th point is — xn. Now Yaroslav wants to execute m queries, each of them is of one of the two following types:

  1. Move the pj-th point from position xpj to position xpj + dj. At that, it is guaranteed that after executing such query all coordinates of the points will be distinct. 
  2. Count the sum of distances between all pairs of points that lie on the segment [lj, rj] (lj ≤ rj). In other words, you should count the sum of: <image>. 



Help Yaroslav.

Input

The first line contains integer n — the number of points (1 ≤ n ≤ 105). The second line contains distinct integers x1, x2, ..., xn — the coordinates of points (|xi| ≤ 109).

The third line contains integer m — the number of queries (1 ≤ m ≤ 105). The next m lines contain the queries. The j-th line first contains integer tj (1 ≤ tj ≤ 2) — the query type. If tj = 1, then it is followed by two integers pj and dj (1 ≤ pj ≤ n, |dj| ≤ 1000). If tj = 2, then it is followed by two integers lj and rj ( - 109 ≤ lj ≤ rj ≤ 109).

It is guaranteed that at any moment all the points have distinct coordinates.

Output

For each type 2 query print the answer on a single line. Print the answers in the order, in which the queries follow in the input.

Please, do not use the %lld specifier to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams of the %I64d specifier.

Examples

Input

8
36 50 28 -75 40 -60 -95 -48
20
2 -61 29
1 5 -53
1 1 429
1 5 130
2 -101 -71
2 -69 53
1 1 404
1 5 518
2 -101 53
2 50 872
1 1 -207
2 -99 -40
1 7 -389
1 6 -171
1 2 464
1 7 -707
1 1 -730
1 1 560
2 635 644
1 7 -677


Output

176
20
406
1046
1638
156
0
#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;
    }
  }
}
