UVa 10644 - Floor Tiles

10644 - Floor Tiles

 * http://acm.uva.es/p/v106/10644.html

Summary
This problem is designed to be one of those "write-code-that-you-don't-really-need" problem.

Explanation
Follow the instructions, write brute force code that will time out (this code is what you don't really need in your submission). Find a pattern. Trivialize the problem. Write a solution that takes 20 lines (if you want to place high on the rank list, then you need to do a little bit more thinking and some DP).

Gotcha's

 * L2 can be smaller than L1.
 * W2 can be smaller than W1.

Input
7 2 2 2 3 2 3 3 4 3 3 3 3 2 2 2 4 1 6 1 6 1 1 1 1 1 10 1 10

Output
1 2 0 1 13 0 38