#arc113d. [arc113_d]Sky Reflector
[arc113_d]Sky Reflector
Problem Statement
In a grid with horizontal rows and vertical columns of squares, we will write an integer between and (inclusive) on each square and define sequences as follows:
- for each , is the minimum value written on a square in the -th row;
- for each , is the maximum value written on a square in the -th column.
Given , find the number of different pairs of sequences that can be , modulo .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the number of different pairs of sequences that can be , modulo .
Sample Input 1
2 2 2
Sample Output 1
7
can be , , , , , , or - there are seven candidates.
Sample Input 2
1 1 100
Sample Output 2
100
Sample Input 3
31415 92653 58979
Sample Output 3
469486242