atcoder#ABC196D. [ABC196D] Hanjo
[ABC196D] Hanjo
Score : points
Problem Statement
We have a rectangular room that is meters long and meters wide. We will cover this room with indistinguishable meters meters rectangular tatami mats and indistinguishable meter meter square tatami mats. The rectangular mats can be used in either direction: they can be meters long and meter wide, or meter long and meters wide. How many ways are there to do this? Here, it is guaranteed that , and two ways are distinguished if they match only after rotation, reflection, or both.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
2 2 1 2
4
There are four ways as follows:
3 3 4 1
18
There are six ways as follows, and their rotations.
4 4 8 0
36