#include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::deque;
using std::endl;
using std::getline;
using std::greater;
using std::istringstream;
using std::make_pair;
using std::map;
using std::max;
using std::min;
using std::multimap;
using std::pair;
using std::priority_queue;
using std::queue;
using std::set;
using std::sort;
using std::stack;
using std::string;
using std::swap;
using std::vector;
const int MAXN(200010);
const int MAXM(10010);
const int MAXE(10010);
const int MAXH(19);
const int INFI(2000000000);
const int MOD(10000);
const unsigned long long BASE(31);
const long long LIM(10000000);
const int INV(-10000);
struct ELE {
  int num;
  bool flag;
  friend bool operator<(const ELE &op1, const ELE &op2) {
    return op1.num == op2.num ? op1.flag : op1.num < op2.num;
  }
};
ELE table[MAXN];
int quant;
int arr[100010], tarr[100010];
struct SEGMENT_TREE {
  struct NODE {
    long long sum, ans;
    int size;
  };
  NODE node[MAXN << 2];
  inline int lson(int sour) { return sour << 1; }
  inline int rson(int sour) { return (sour << 1) | 1; }
  void push_up(NODE &sour, NODE &ls, NODE &rs) {
    sour.size = ls.size + rs.size;
    sour.sum = ls.sum + rs.sum;
    sour.ans = ls.size * rs.sum - ls.sum * rs.size + ls.ans + rs.ans;
  }
  void build(int l, int r, int rt) {
    if (l == r) {
      node[rt].ans = 0;
      node[rt].size = table[l].flag ? 1 : 0;
      node[rt].sum = table[l].flag ? table[l].num : 0;
      return;
    }
    int m = (l + r) >> 1;
    build(l, m, lson(rt));
    build(m + 1, r, rson(rt));
    push_up(node[rt], node[lson(rt)], node[rson(rt)]);
  }
  int goal, flag, value;
  void change(int l, int r, int rt) {
    if (l == r) {
      node[rt].size = flag ? 1 : 0;
      node[rt].sum = flag ? value : 0;
      return;
    }
    int m = (l + r) >> 1;
    if (goal <= m)
      change(l, m, lson(rt));
    else
      change(m + 1, r, rson(rt));
    push_up(node[rt], node[lson(rt)], node[rson(rt)]);
  }
  int select(int l, int r, int rt, int kth) {
    if (l == r) return l;
    int m = (l + r) >> 1;
    if (kth <= node[lson(rt)].size)
      return select(l, m, lson(rt), kth);
    else
      return select(m + 1, r, rson(rt), kth - node[lson(rt)].size);
  }
  int ql, qr;
  void query(int l, int r, int rt, NODE &ret) {
    if (ql <= l && qr >= r) {
      ret = node[rt];
      return;
    }
    int m = (l + r) >> 1;
    NODE t1, t2;
    if (ql <= m)
      query(l, m, lson(rt), t1);
    else
      t1.ans = t1.sum = t1.size = 0;
    if (qr > m)
      query(m + 1, r, rson(rt), t2);
    else
      t2.ans = t2.sum = t2.size = 0;
    push_up(ret, t1, t2);
  }
};
SEGMENT_TREE st;
int find(int goal) {
  int l = 1, r = quant + 1;
  while (l < r) {
    int m = (l + r) >> 1;
    if (table[m].num < goal)
      l = m + 1;
    else
      r = m;
  }
  return l;
}
int op[100010][3];
int main() {
  int n;
  while (~scanf("%d", &n)) {
    quant = 0;
    table[++quant].num = -INFI;
    table[quant].flag = true;
    table[++quant].num = INFI;
    table[quant].flag = true;
    for (int i = 1; i <= n; ++i) {
      scanf("%d", arr + i);
      table[++quant].num = tarr[i] = arr[i];
      table[quant].flag = true;
    }
    int m;
    scanf("%d", &m);
    for (int i = 1; i <= m; ++i) {
      scanf("%d%d%d", op[i], op[i] + 1, op[i] + 2);
      if (op[i][0] == 1) {
        arr[op[i][1]] += op[i][2];
        table[++quant].num = arr[op[i][1]];
        table[quant].flag = false;
      }
    }
    sort(table + 1, table + 1 + quant);
    int temp = quant;
    quant = 1;
    for (int i = 2; i <= temp; ++i)
      if (table[i].num != table[quant].num) table[++quant] = table[i];
    st.build(1, quant, 1);
    for (int i = 1; i <= m; ++i) {
      if (op[i][0] == 1) {
        int ind = find(tarr[op[i][1]]);
        st.goal = ind;
        st.flag = 0;
        st.change(1, quant, 1);
        tarr[op[i][1]] += op[i][2];
        ind = find(tarr[op[i][1]]);
        st.goal = ind;
        st.flag = 1;
        st.value = tarr[op[i][1]];
        st.change(1, quant, 1);
      } else {
        int ind = find(op[i][1]);
        st.ql = ind;
        ind = find(op[i][2]);
        if (table[ind].num > op[i][2]) --ind;
        st.qr = ind;
        SEGMENT_TREE::NODE ans;
        st.query(1, quant, 1, ans);
        printf("%I64d\n", ans.ans);
      }
    }
  }
  return 0;
}
