public void solve() throws IOException {
    int n = nextInt();
    int[] capacities = new int[n];
    int[] vessels = new int[n];
    int[] nextfree = new int[n];
    for (int x = 0; x < n; x++) {
      capacities[x] = nextInt();
      vessels[x] = 0;
      nextfree[x] = x;
    }
    int m = nextInt();
    for (int x = 0; x < m; x++) {
      int type = nextInt();
      if (type == 1) {
        int vessel = nextInt();
        int amount = nextInt();
        int next = nextfree[vessel - 1];
        if (next < vessels.length) {
          vessels[next] += amount;
          nextfree[next] = overflow(vessels, capacities, nextfree, nextfree[vessel - 1]);
        }
      }
      if (type == 2) {
        int vessel = nextInt();
        System.out.println(vessels[vessel - 1]);
      }
    }
  }