There is a system of *n* vessels arranged one above the other as shown in the figure below. Assume that the vessels are numbered from 1 to *n*, in the order from the highest to the lowest, the volume of the *i*-th vessel is *a*<sub class="lower-index">*i*</sub> liters.

Initially, all the vessels are empty. In some vessels water is poured. All the water that overflows from the *i*-th vessel goes to the (*i* + 1)-th one. The liquid that overflows from the *n*-th vessel spills on the floor.

Your task is to simulate pouring water into the vessels. To do this, you will need to handle two types of queries:
 1.  Add *x*<sub class="lower-index">*i*</sub> liters of water to the *p*<sub class="lower-index">*i*</sub>-th vessel; 1.  Print the number of liters of water in the *k*<sub class="lower-index">*i*</sub>-th vessel. 
When you reply to the second request you can assume that all the water poured up to this point, has already overflown between the vessels.
The first line contains integer *n* — the number of vessels (1 ≤ *n* ≤ 2·10<sup class="upper-index">5</sup>). The second line contains *n* integers *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub> — the vessels' capacities (1 ≤ *a*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">9</sup>). The vessels' capacities do not necessarily increase from the top vessels to the bottom ones (see the second sample). The third line contains integer *m* — the number of queries (1 ≤ *m* ≤ 2·10<sup class="upper-index">5</sup>). Each of the next *m* lines contains the description of one query. The query of the first type is represented as "1 *p*<sub class="lower-index">*i*</sub> *x*<sub class="lower-index">*i*</sub>", the query of the second type is represented as "2 *k*<sub class="lower-index">*i*</sub>" (1 ≤ *p*<sub class="lower-index">*i*</sub> ≤ *n*, 1 ≤ *x*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">9</sup>, 1 ≤ *k*<sub class="lower-index">*i*</sub> ≤ *n*).
class node:
    def __init__(self, key, value):
        self.key = key
        self.value = value
        self.left = self.right = None
        self.depth = 1
        self.size = 1

    def find(self, key):
        if key == self.key:
            return self
        if key < self.key:
            return self.left.find(key) if self.left else False
        else:
            return self.right.find(key) if self.right else False

    def add(self, key, value):
        # if self.key == key:
        #     return self
        if key < self.key:
            self.left = self.left.add(key, value) if self.left else node(key, value)
        else:
            self.right = self.right.add(key, value) if self.right else node(key, value)
        return self.balance()

    def list(self, p):
        if self.left:
            self.left.list(p)
        p.append(self.key)
        if self.right:
            self.right.list(p)
        return p

    def recalc(self):
        d1 = self.left.depth if self.left else 0
        d2 = self.right.depth if self.right else 0
        s1 = self.left.size if self.left else 0
        s2 = self.right.size if self.right else 0
        self.depth = max(d1, d2) + 1
        self.size = s1+s2+1

    def left_rot(self):
        b = self.right
        self.right = b.left
        b.left = self
        self.recalc()
        b.recalc()
        return b

    def right_rot(self):
        b = self.left
        self.left = b.right
        b.right = self
        self.recalc()
        b.recalc()
        return b

    def big_left_rot(self):
        self.right = self.right.right_rot()
        return self.left_rot()

    def big_right_rot(self):
        self.left = self.left.left_rot()
        return self.right_rot()

    def left_depth(self):
        return self.left.depth if self.left else 0

    def right_depth(self):
        return self.right.depth if self.right else 0

    def balance(self):
        self.recalc()
        if self.right_depth() - self.left_depth() == 2:
            if self.right.left_depth() <= self.right.right_depth():
                return self.left_rot()
            else:
                return self.big_left_rot()
        if self.left_depth() - self.right_depth() == 2:
            if self.left.right_depth() <= self.left.left_depth():
                return self.right_rot()
            else:
                return self.big_right_rot()
        return self

    def min(self): # возвращает ссылку на минимальный элемент поддерева
        return self.left.min() if self.left else self

    def remove_min(self):
        if not self.left:
            return self.right
        self.left = self.left.remove_min()
        return self.balance()

    def remove(self, key):
        if key == self.key:
            if not self.right:
                return self.left
            nd = self.right.min()
            self.key, self.value = nd.key, nd.value
            self.right = self.right.remove_min()
            return self.balance()
        if key < self.key:
            self.left = self.left.remove(key)
        else:
            self.right = self.right.remove(key)
        return self.balance()

    def count_less(self, key):
        if key <= self.key:
            return self.left.count_less(key) if self.left else 0
        else:
            return (self.left.size if self.left else 0) + 1 + (self.right.count_less(key) if self.right else 0)

    def count_less_or_equal(self, key):
        if key < self.key:
            return self.left.count_less_or_equal(key) if self.left else 0
        else:
            return (self.left.size if self.left else 0) + 1 + (self.right.count_less_or_equal(key) if self.right else 0)

    def index(self, i): # ссылка на i-тый элемент по порядку
      left_size = self.left.size if self.left else 0
      if left_size == i:
          return self
      if self.left and self.left.size > i:
          return self.left.index(i)
      else:
          return self.right.index(i-1-left_size) if self.right else False

    def last_less(self, key): # ссылка на последний элемент, меньший key
      if key <= self.key:
          return self.left.last_less(key) if self.left else False
      else:
          nd = self.right.last_less(key) if self.right else False
          if not nd:
              return self
          else:
              return nd
            
    def first_more(self, key):
      if key >= self.key:
          return self.right.first_more(key) if self.right else False
      else:
          nd = self.left.first_more(key) if self.left else False
          if not nd:
              return self
          else:
              return nd

n = int(input()) 
a = [0] + list(map(int, input().split())) + [10**18]
tr = node(n+1, 0)
for i in range(1, n+1):
  tr = tr.add(i, 0)
m = int(input())
for _ in range(m):
  q = list(map(int, input().split()))
  if q[0] == 1:
    p, x = q[1], q[2]
    nd = tr.first_more(p-1)
    nd.value += x
    while nd.value >= a[nd.key]:
      nd1 = tr.first_more(nd.key)
      nd1.value += nd.value - a[nd.key]
      tr.remove(nd.key)
      nd = nd1
  else:
    k = q[1]
    nd = tr.find(k)
    if not nd:
      print(a[k])
    else:
      print(nd.value)