Paint Estimate

For each floor plan, compute the paintable wall and ceiling area minus window and door areas, multiply by the number of apartments, and round the total up by the coverage of one can.

Easy2MathImplementationBrute forceSimulationInterviewNo attempts yetTime limit2sMemory limit512 MB

Problem

A contractor is preparing a bid to paint the interiors of a student apartment building. Each apartment is a single rectangular room with plain drywall walls and a flat ceiling, and no molding. The crew paints the four walls and the ceiling of that room. Closets and bathrooms are left unpainted, and the openings where windows and doors sit take no paint. Rooms, windows and doors are all rectangular, and every room gets the same color.

For each floor plan you are given the size of the room, the size of every window and door, and the number of apartments that use that plan. Report how many cans of paint the bid needs.

The painted area of one apartment is the ceiling area width×lengthwidth \times length plus the area of the four walls 2×(width+length)×height2 \times (width + length) \times height, minus the area of every window and door.

Input

The input holds several test cases. Each test case begins with a line of six integers.

n width length height area m

nn (1n1001 \le n \le 100) is the number of apartments, widthwidth (8width1008 \le width \le 100) is the width of the room, lengthlength (10length10010 \le length \le 100) is the length of the room, heightheight (8height308 \le height \le 30) is the height of the room, areaarea (100area1000100 \le area \le 1\,000) is the area in square feet that one can of paint covers, and mm (0m100 \le m \le 10) is the number of windows and doors.

Each of the next mm lines holds two integers, the width and the height of one window or door. No window or door is larger than the largest wall, and both numbers are positive. Within one apartment the total area of the windows and doors is smaller than the painted area. All lengths are in feet.

The last line of the input holds six zeros. That line is not a test case.

Output

For each test case print one integer on its own line: the number of cans of paint needed to paint the walls and ceilings of all nn apartments.

Add up the painted area of all nn apartments first, then divide that sum by the area one can covers and round up. Do not round up for each apartment separately. Print no extra spaces and no blank lines.