1034: Count Sequences
Memory Limit:1024 MB
Time Limit:4.000 S
Judge Style:Text Compare
Creator:
Submit:20
Solved:7
Description
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
Input
The input is given from Standard Input in the following format:
- All values in the input are integers.
Output
Print the answer.
Sample Input Copy
3 4
Sample Output Copy
8
HINT
Here are the eight sequences that satisfy the conditions.