A contractor is bidding on the interior painting for a student-housing apartment building. Every apartment is a single-room efficiency with plain drywall walls and a plain ceiling, with no crown molding or other trim. In each apartment the crew paints the four walls and the ceiling in a single color. The floor is never painted, and the openings for windows and doors are left unpainted. Every room, window, and door is a rectangle.
You are given the room dimensions, the list of window and door openings for a floor plan, and how many apartments share that plan. Report how many cans of paint the contractor must buy.
For one apartment the paintable area is the four walls plus the ceiling, minus the openings:
$$A = 2 \cdot \text{height} \cdot (\text{width} + \text{length}) + \text{width} \cdot \text{length} - \sum_{i} w_i \cdot h_i$$
One can of paint covers a fixed area, and paint is sold only in whole cans, so the number of cans is always rounded up.
The input contains several test cases. Each test case starts with a line of six integers:
n width length height area m
Then follow $m$ lines, each with two positive integers: the width and the height of one door or window, in feet. No window or door is larger than the largest wall.
The input ends with a line containing six zeros, which is not processed.
For each test case, print a single integer on its own line: the number of cans of paint needed to paint the walls and ceilings of all the apartments that share this floor plan. Round up, because paint is sold only in whole cans.