atcoder#KEYENCE2019F. Paper Cutting
Paper Cutting
Score : points
Problem Statement
There is a rectangular sheet of paper with height and width . We introduce an -coordinate system so that the four corners of the sheet are , , and .
This sheet can be cut along the lines and the lines . Consider a sequence of operations of length where we choose of these lines and cut the sheet along those lines one by one in some order.
Let the score of a cut be the number of pieces of paper that exist just after the cut. The score of a sequence of operations is the sum of the scores of all of the cuts.
Find the sum of the scores of all possible sequences of operations of length . Since this value can be extremely large, print the number modulo .
Constraints
- and are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the sum of the scores, modulo .
2 1 2
34
Let , and denote the cuts along the lines , and , respectively. The six possible sequences of operations and the score of each of them are as follows:
- :
- :
- :
- :
- :
- :
The sum of these is .
30 40 50
616365902
Be sure to print the sum modulo .