The sale bin of Big Box Bargains contains products in a row. The th item has price per unit. There is no limit to the quantity of any item.

There are customers who will enter the store to buy items. The th customer has dollars, starts at item and walks to the right to item (inclusive), one item at a time.

Each time they encounter an item, they will buy as many units of the item as they can afford.

You are now wondering, for each customer, how much money they will have left after buying items.

#### Input

The first line of input contains two space-separated integers and .

The next line of input contains space-separated integers .

Each of the next lines contains three space-separated integers , , and .

#### Output

For each of the customers, print, on a single line, a single integer indicating the remaining amount of money after shopping.

#### Sample Input

```
5 3
5 3 2 4 6
8 5 5
107 1 4
7 3 5
```

#### Sample Output

```
2
0
1
```

## Comments

nice of yall to make the very last case time out and not even give partial points 💀