is delivering a large quantity of identical-sized microwaves to MC (Microwave Central). To make things faster, he has borrowed a truck from his magic grandpa.
A little known fact is that when microwaves enter Microwave Central, they must all be aligned in the same way. Thus,
must pack all of the microwaves into the truck in the same orientation. In particular, each side of the microwave must be parallel to one side of the truck.microwaves to pack, and each microwave is a rectangular prism with dimensions by by . The truck he borrowed is a rectangular prism with dimensions by by . Please help figure out how many trips he will have to make so he can inform his magic grandpa!
hasInput Specification
The first line of input will contain a single integer:
The next line of input will contain three space-separated integers, , , and , the dimensions of each microwave.
The next line of input will contain three space-separated integers, , , and , the dimensions of the truck.
Output Specification
Output a single integer: the minimal number of trips SCAMMED
.
Note: It is recommended to use 64-bit integers (long long
in C++, int64
in Pascal, long
in Java) when computing the answer. It is guaranteed that the maximum number of microwaves that can fit in a truck will fit in a 64-bit signed integer.
Sample Input 1
1500
3 1 2
20 30 10
Sample Output 1
2
Explanation for Sample Output 1
If
optimally arranges microwaves, he can fit 1000 microwaves inside of the truck at once. Thus, he can deliver all of the microwaves in 2 trips.Sample Input 2
1500
30 10 20
5 5 5
Sample Output 2
SCAMMED
Explanation for Sample Output 2
SCAMMED
.
Comments
The fear of microwaves: Microphobia
This comment is hidden due to too much negative feedback. Show it anyway.