Олимпиадный тренинг

Задача 33633. Laptop warehouse


Notebooks packed in boxes were brought to the warehouse, which has the shape of a rectangular parallelepiped. Each box also has the shape of a rectangular parallelepiped. According to the storage rules, boxes with laptops must be placed in a warehouse with the following two conditions:
1. The sides of the boxes must be parallel to the sides of the warehouse.
2. When placing a box in a warehouse, it is allowed to place it anywhere (with the fulfillment of the previous condition), including on another box, but all boxes must be oriented in the same way (i.e. you cannot place one box “standing” and the other &mdash ;“lying”)

Write a program that will determine the maximum number of laptops that can be placed in the warehouse, given the size of the warehouse and the size of the box with a laptop.

Input: The program receives six natural numbers as input. The first three define the length, height and width of the warehouse. The next three sets the length, height, and width of the laptop box, respectively.
Output: The program should output a single number — the maximum number of laptops that can be placed in the warehouse.

Examples
# Input Output
1 100
200
300
1
2
3
1000000
2 100
200
300
3
2
1
1000000
3 100
100
1
2
2
2
0
4 7
7
7
3
3
3
8