#P1542E1. Abnormal Permutation Pairs (easy version)
Abnormal Permutation Pairs (easy version)
No submission language available for this problem.
Description
This is the easy version of the problem. The only difference between the easy version and the hard version is the constraints on . You can only make hacks if both versions are solved.
A permutation of is a sequence of integers, where each integer from to appears exactly once. For example, is a permutation of , but isn't because appears twice in it.
Recall that the number of inversions in a permutation is the number of pairs of indices such that and .
Let and be two permutations of . Find the number of permutation pairs that satisfy the following conditions:
- is lexicographically smaller than .
- the number of inversions in is greater than the number of inversions in .
Print the number of such pairs modulo . Note that may not be a prime.
The only line contains two integers and (, ).
Print one integer, which is the answer modulo .
Input
The only line contains two integers and (, ).
Output
Print one integer, which is the answer modulo .
Samples
Note
The following are all valid pairs when .
- , ,
- , ,
- , ,
- , ,
- , ,
- , ,
- , ,
- , ,
- , ,
- , ,
- , ,
- , ,
- , ,
- , ,
- , ,
- , ,
- , .