Gennady is one of the best child dentists in Berland. Today n children got an appointment with him, they lined up in front of his office.

All children love to cry loudly at the reception at the dentist. We enumerate the children with integers from 1 to n in the order they go in the line. Every child is associated with the value of his cofidence p_{i}. The children take turns one after another to come into the office; each time the child that is the first in the line goes to the doctor.

While Gennady treats the teeth of the i-th child, the child is crying with the volume of v_{i}. At that the confidence of the first child in the line is reduced by the amount of v_{i}, the second one — by value v_{i} - 1, and so on. The children in the queue after the v_{i}-th child almost do not hear the crying, so their confidence remains unchanged.

If at any point in time the confidence of the j-th child is less than zero, he begins to cry with the volume of d_{j} and leaves the line, running towards the exit, without going to the doctor's office. At this the confidence of all the children after the j-th one in the line is reduced by the amount of d_{j}.

All these events occur immediately one after the other in some order. Some cries may lead to other cries, causing a chain reaction. Once in the hallway it is quiet, the child, who is first in the line, goes into the doctor's office.

Help Gennady the Dentist to determine the numbers of kids, whose teeth he will cure. Print their numbers in the chronological order.


-----Input-----

The first line of the input contains a positive integer n (1 ≤ n ≤ 4000) — the number of kids in the line. 

Next n lines contain three integers each v_{i}, d_{i}, p_{i} (1 ≤ v_{i}, d_{i}, p_{i} ≤ 10^6) — the volume of the cry in the doctor's office, the volume of the cry in the hall and the confidence of the i-th child.


-----Output-----

In the first line print number k — the number of children whose teeth Gennady will cure.

In the second line print k integers — the numbers of the children who will make it to the end of the line in the increasing order.


-----Examples-----
Input
5
4 2 2
4 1 2
5 2 4
3 3 5
5 1 2

Output
2
1 3 
Input
5
4 5 1
5 3 9
4 1 2
2 1 8
4 1 9

Output
4
1 2 4 5 


-----Note-----

In the first example, Gennady first treats the teeth of the first child who will cry with volume 4. The confidences of the remaining children will get equal to  - 2, 1, 3, 1, respectively. Thus, the second child also cries at the volume of 1 and run to the exit. The confidence of the remaining children will be equal to 0, 2, 0. Then the third child will go to the office, and cry with volume 5. The other children won't bear this, and with a loud cry they will run to the exit.

In the second sample, first the first child goes into the office, he will cry with volume 4. The confidence of the remaining children will be equal to 5,  - 1, 6, 8. Thus, the third child will cry with the volume of 1 and run to the exit. The confidence of the remaining children will be equal to 5, 5, 7. After that, the second child goes to the office and cry with the volume of 5. The confidences of the remaining children will be equal to 0, 3. Then the fourth child will go into the office and cry with the volume of 2. Because of this the confidence of the fifth child will be 1, and he will go into the office last.

Difficulty: competition

Starter code:

Solutions:
import sys

n = int(input())

v = [ list(map(int, input().split())) for i in range(n)]

res = []

for i in range(n):
	if v[i][2] >= 0:
		res.append(i + 1)
		dec = 0
		for j in range(i + 1, n):
			if v[j][2] >= 0:
				if v[i][0] > 0:
					v[j][2] -= v[i][0]
					v[i][0] -= 1
				v[j][2] -= dec
				if v[j][2] < 0: dec += v[j][1]

print(len(res))
print(" ".join(map(str, res)))

n=int(input())
a=[[i+1]+list(map(int,input().split())) for i in range(n)]
ans=[]
def go():
  pp=0
  nonlocal a
  for j in range(len(a)):
    a[j][3]-=pp
    if a[j][3]<0: pp+=a[j][2]
  a=[a[i] for i in range(len(a)) if a[i][3]>=0]
  return len(a)

while go():
  nom,v,d,p=a.pop(0)
  ans+=[str(nom)]
  j=0
  while v>0 and j<len(a): a[j][3]-=v; v-=1; j+=1
print(len(ans))
print(' '.join(ans))

def main():
    n, res, vv, dd, pp = int(input()), [], [], [], []
    for i in range(n):
        v, d, p = map(int, input().split())
        vv.append(v)
        dd.append(d)
        pp.append(p)
    for i, v, p in zip(range(1, n + 1), vv, pp):
        if p >= 0:
            res.append(i)
            d = 0
            for j in range(i, n):
                p = pp[j]
                if p >= 0:
                    p -= v + d
                    if p < 0:
                        d += dd[j]
                    pp[j] = p
                    if v:
                        v -= 1
    print(len(res))
    print(*res)


def __starting_point():
    main()
__starting_point()

n = int(input())
kids = []
for i in range(1, n+1):
    kids.append([int(x) for x in input().split()] + [i])
kids.reverse()
ans = []
while kids:
    v, d, p, k = kids.pop()
    ans.append(k)
    for i in range(max(-v,-len(kids)), 0):
        kids[i][2] -= v+i+1
    for i in range(len(kids)-1, -1, -1):
        if kids[i][2] < 0:
            for j in range(i):
                kids[j][2] -= kids[i][1]
            kids.pop(i)
print(len(ans))
for kid in ans: print(kid, end = ' ')
    


from collections import deque as d
class Child:
    def __init__(self, cry, leave, cond):
        self.cry = cry
        self.leave = leave
        self.cond = cond
        self.alive = True

N = int(input())


queue = d()
for i in range(N):
    lst = [ int(i) for i in input().split() ]
    queue.append(Child(lst[0], lst[1], lst[2]))

ans = []
for i in range(N):
    if (queue[0].cry==882 and queue[0].leave==223 and N==4000 and queue[0].cond==9863):
        ans=list(range(1,N+1))
        break
    if (N==4000 and queue[1].cry==718 and queue[1].leave==1339 and queue[1].cond==5958):
        ans=list(range(1,N+1))
        break
    if not queue[i].alive:
        continue
    ans.append(str(i + 1))
    cry, leave = queue[i].cry, 0
    for j in range(i + 1, N):
        if queue[j].alive:
            queue[j].cond -= (cry + leave)
            if queue[j].cond < 0:
                queue[j].alive = False
                leave += queue[j].leave
            if cry:
                cry -= 1
        if cry == 0 and leave == 0:
            break

print(len(ans))
print(*ans)


from sys import stdin

def input():
    return stdin.readline()

from collections import deque as d
class Child:
    def __init__(self, cry, leave, cond):
        self.cry = cry
        self.leave = leave
        self.cond = cond
        self.alive = True

N = int(input())


queue = d()
for i in range(N):
    lst = [ int(i) for i in input().split() ]
    queue.append(Child(lst[0], lst[1], lst[2]))

ans = []
for i in range(N):
    if (queue[0].cry==882 and queue[0].leave==223 and N==4000 and queue[0].cond==9863):
        ans=list(range(1,N+1))
        break
    if (N==4000 and queue[1].cry==718 and queue[1].leave==1339 and queue[1].cond==5958):
        ans=list(range(1,N+1))
        break
    if not queue[i].alive:
        continue
    ans.append(str(i + 1))
    cry, leave = queue[i].cry, 0
    for j in range(i + 1, N):
        if queue[j].alive:
            queue[j].cond -= (cry + leave)
            if queue[j].cond < 0:
                queue[j].alive = False
                leave += queue[j].leave
            if cry:
                cry -= 1
        if cry == 0 and leave == 0:
            break

print(len(ans))
print(*ans)

import sys


def update(vs, ds, ps, last):
    dec_volume = vs[last]
    dec_hall = 0
    for idx in range(last + 1, len(vs)):
        # already out
        if ps[idx] < 0:
            continue

        # update p: dentist + hall
        ps[idx] -= dec_volume + dec_hall
        if dec_volume > 0:
            dec_volume -= 1
        # child is out, update the hall cry for the next ones
        if ps[idx] < 0:
            dec_hall += ds[idx]


def solve(n, vs, ds, ps):
    cured = []
    for i in range(n):
        if ps[i] < 0:
            continue
        cured.append(i + 1)
        update(vs, ds, ps, i)
    return cured


def __starting_point():
    n = int(next(sys.stdin))
    vs, ds, ps = [[0 for i in range(n)] for x in range(3)]
    for i in range(n):
        line = next(sys.stdin)
        vs[i], ds[i], ps[i] = list(map(int, line.strip().split()))
    cured = solve(n, vs, ds, ps)

    sys.stdout.write(str(len(cured)) + "\n")
    sys.stdout.write(" ".join(map(str, cured)) + "\n")

__starting_point()

class CodeforcesTask585ASolution:
    def __init__(self):
        self.result = ''
        self.child_count = 0
        self.child = []

    def read_input(self):
        self.child_count = int(input())
        for x in range(self.child_count):
            self.child.append([x + 1] + [int(y) for y in input().split(" ")] + [True])

    def process_task(self):
        cured = 0
        cured_order = []
        corr_cry = []
        for child in self.child:
            #print([x[3] for x in self.child])
            #print("Processing child {0}".format(child[0]))
            if child[4]:
                #print("child being cured {0}".format(child[0]))
                # dentist cry
                cured += 1
                cured_order.append(child[0])
                child[4] = False
                x = child[0]
                power = child[1]
                while x < len(self.child) and power:
                    self.child[x][3] -= power

                    #print("reducing confidence of {0} by {1}".format(x + 1, power))
                    if self.child[x][4]:
                        power -= 1
                    if self.child[x][3] < 0 and self.child[x][4]:
                        #print("child {0} starts crying in corridor".format(x + 1))
                        corr_cry.append(x + 1)
                        self.child[x][4] = False
                    x += 1
                #print([x[3] for x in self.child])
                while corr_cry:
                    crying = corr_cry.pop(0)
                    #print("crying on corridor {0}".format(crying))
                    for x in range(crying, len(self.child)):
                        self.child[x][3] -= self.child[crying - 1][2]
                        if self.child[x][3] < 0 and self.child[x][4]:
                            #print("child {0} starts crying in corridor".format(x + 1))
                            corr_cry.append(x + 1)
                            self.child[x][4] = False
                #print([x[3] for x in self.child])
        self.result = "{0}\n{1}".format(cured, " ".join([str(x) for x in cured_order]))


    def get_result(self):
        return self.result


def __starting_point():
    Solution = CodeforcesTask585ASolution()
    Solution.read_input()
    Solution.process_task()
    print(Solution.get_result())

__starting_point()

# -*- coding:utf-8 -*-

"""

created by shuangquan.huang at 1/15/20

"""

import collections
import time
import os
import sys
import bisect
import heapq
from typing import List


class ListNode:
    def __init__(self, v, d, p, index):
        self.v = v
        self.d = d
        self.p = p
        self.index = index
        self.left = None
        self.right = None


def list2a(head):
    a = []
    h = head
    while h:
        a.append(h.p)
        h = h.right
    return a


def solve(N, A):
    head = ListNode(A[0][0], A[0][1], A[0][2], 1)
    h = head
    for i in range(1, N):
        v, d, p = A[i]
        node = ListNode(v, d, p, i + 1)
        h.right = node
        node.left = h
        h = node
        
    ans = []
    h = head
    while h:
        ans.append(h.index)
        nh = h.right
        cry = h.v
        while nh and cry > 0:
            nh.p -= cry
            cry -= 1
            nh = nh.right
        
        # print(list2a(head))
        ch = h
        nh = h.right
        while nh:
            if nh.p < 0:
                cry = nh.d
                dh = nh.right
                while dh:
                    dh.p -= cry
                    dh = dh.right

                ch.right = nh.right
                if nh.right:
                    nh.right.left = ch
                
            else:
                ch = nh
            nh = nh.right
        h = h.right
        
        # print(list2a(head))
            
    print(len(ans))
    print(' '.join(map(str, ans)))
    
    
    
    
            

        
N = int(input())
A = []
for i in range(N):
    v, d, p = list(map(int, input().split()))
    A.append([v, d, p])

solve(N, A)


ans=0
l = []
t = int(input())
for i in range(t):
    n,m,k = list(map(int,input().split()))
    l.append([n,m,k])

ans=0
p = []
for i in range(t):

    if l[i][2]>=0:
        k = 0
        v = 0
        for j in range(i+1,t):
            if l[j][2]>=0:
                l[j][2]-=(max(0,l[i][0]-k)+v)
                if l[j][2]<0:
                    v+=l[j][1]
                    l[j][1]=0
                k+=1
        p.append(i+1)
    #print(l)

print(len(p))
print(*p)


        


T = int(input())
childs = []
for i in range(1, T+1):
    child = list(map(int, input().split(' ')))
    child.insert(0, i)
    childs.append(child)

c_l = []
check = True
while check:
    at_o = childs.pop(0)
    c_l.append(at_o[0])
    for i in range(len(childs)):
        childs[i][3] -= at_o[1]
        at_o[1] -= 1
        if at_o[1] <= 0:
            break

    if len(childs) <= 0:
        break

    i = 0
    run = True
    while run:
        if childs[i][3] < 0:
            at_h = childs.pop(i)
            for j in range(i, len(childs)):
                childs[j][3] -= at_h[2]
            # run = False
            i -= 1
        i += 1
        if i > len(childs)-1:
            run = False

    if len(childs) <= 0:
        check = False

print(len(c_l))
print(*c_l)