MicroWave



MicrowaveMicroWaveMicroWave

You may be familiar with microwave images as they are used on TV weather news and you can even use microwaves to cook your food. Microwave ovens work by using microwave about 12 centimeters in length to force water and fat molecules in food to rotate. From reheating leftovers to popping popcorn, a countertop microwave brings convenient cooking to your kitchen. At Lowe’s countertop microwaves come in a variety of.

Potato

You have a malfunctioning microwave in which you want to put some bananas. You have $$$n$$$ time-steps before the microwave stops working completely. At each time-step, it displays a new operation.

Let $$$k$$$ be the number of bananas in the microwave currently. Initially, $$$k = 0$$$. In the $$$i$$$-th operation, you are given three parameters $$$t_i$$$, $$$x_i$$$, $$$y_i$$$ in the input. Based on the value of $$$t_i$$$, you must do one of the following:

Type 1: ($$$t_i=1$$$, $$$x_i$$$, $$$y_i$$$) — pick an $$$a_i$$$, such that $$$0 le a_i le y_i$$$, and perform the following update $$$a_i$$$ times: $$$k:=lceil (k + x_i) rceil$$$.

Microwave Oven

Type 2: ($$$t_i=2$$$, $$$x_i$$$, $$$y_i$$$) — pick an $$$a_i$$$, such that $$$0 le a_i le y_i$$$, and perform the following update $$$a_i$$$ times: $$$k:=lceil (k cdot x_i) rceil$$$.

Note that $$$x_i$$$ can be a fractional value. See input format for more details. Also, $$$lceil x rceil$$$ is the smallest integer $$$ge x$$$.

Microwaves Wave

At the $$$i$$$-th time-step, you must apply the $$$i$$$-th operation exactly once.

Microwave Potato

For each $$$j$$$ such that $$$1 le j le m$$$, output the earliest time-step at which you can create exactly $$$j$$$ bananas. If you cannot create exactly $$$j$$$ bananas, output $$$-1$$$.