Winter is beginning and Giorgio's shop has some unsold items left in its warehouses, which will now be put on sale.
The items are arranged in boxes, numbered from to , stacked one on top of the other, each with a weight . Box is the topmost box.
A box can only be removed if all the boxes above it have already been removed.

Giorgio must completely empty his warehouse and to do so he has carts numbered from to .
The -th cart can move a maximum of boxes and the total weight of the boxes transported cannot exceed .
On each trip, Giorgio chooses one of his carts, goes to the warehouse and loads the boxes from the top, respecting the cart's limits. He then returns to the shop and unloads the boxes.
Next, if there are still boxes left, he repeats the operation, choosing whether to change carts or use the same one.
Task
Help Giorgio plan his day by calculating the minimum number of trips he will need to make to empty the warehouse.
Input data
The input file consists of:
- a line containing integer .
- a line containing the integers .
- a line containing integer .
- a line containing the integers .
- a line containing the integers .
Output data
The output file must contain a single line consisting of integer , the answer to the problem.
Constraints and clarifications
- .
- for each .
- for each .
- for each .
- It is always possible to remove all boxes from the warehouse.
| # | Score | Constraints |
|---|---|---|
| 1 | 0 | Examples |
| 2 | 10 | , , and |
| 3 | 10 | |
| 4 | 15 | All are equal |
| 5 | 25 | and |
| 6 | 40 | No additional restrictions |
Example 1
stdin
3
10 10 30
3
3 1 1
25 35 20
stdout
2
Explanation
In the first sample case Giorgio can use the first cart for the first two boxes and the second cart for the last box, so he needs two trips.
Example 2
stdin
5
1 1 1 1 1
2
2 5
5 2
stdout
3
Explanation
In the second sample case Giorgio needs three trips regardless of which cart he chooses.