Travel in Sugar Country
시간 제한1초메모리 제한256 MB
일직선 위 N개 마을에서 서로 다른 K개를 순서대로 고를 때 이동 거리 합이 M의 배수가 되는 경우의 수를 세는 문제이다.
문제
There are towns numbered through . There is a bidirectional road between towns and , and its length is . Thus, for each pairs (, ) (), the distance between towns and is .
At each town there is a sugar shop. An ant wants to visit distinct shops.
The ant wants to choose a set of distinct shops and the order to visit them. For example, if it decides to visit the shops in this order, the total distance it travels will be .
In how many ways the total distance it travels become a multiple of ? Print the answer modulo .
입력
출력
Print the answer modulo .
제한
- All values in the input are integers.
힌트
In Sample 1, there are six ways: , , , , , and .