Sixes
View as PDFGiven an integer , determine the number of ways to roll
six-sided die such that the product of the numbers rolled is divisible by the sum of the numbers rolled. Rolls are ordered (e.g. rolling a
and then a
would be distinct from rolling a
and then a
). Since the answer may be huge, output its value modulo
.
Constraints
Subtask 1 [10%]
Subtask 2 [20%]
Subtask 3 [30%]
Subtask 4 [40%]
No additional constraints.
Input Specification
The first line contains one integer, .
Output Specification
Output one line containing one integer, the number of ordered ways to roll six-sided die such that the product of the numbers rolled is divisible by the sum of the numbers rolled, modulo
.
Sample Input 1
2
Sample Output 1
5
Explanation for Sample 1
The valid rolls of
six-sided die are
,
,
,
, and
. It can be shown that these are the only ways to roll
six-sided die so that the product of the numbers rolled is divisible by the sum of the numbers rolled.
Sample Input 2
66666
Sample Output 2
537825222
Explanation for Sample 2
Remember to output the answer modulo .
Comments