atcoder#ABC276G. [ABC276G] Count Sequences
[ABC276G] Count Sequences
Score : points
Problem Statement
Find the number of sequences of integers with terms, , that satisfy the following conditions, modulo .
- .
- For each , the remainder when is divided by is different from the remainder when is divided by .
Constraints
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
3 4
8
Here are the eight sequences that satisfy the conditions.
276 10000000
909213205
Be sure to find the count modulo .