atcoder#ABC207E. [ABC207E] Mod i
[ABC207E] Mod i
Score : points
Problem Statement
Given is a sequence of numbers. Find the number of ways to separate into some number of non-empty contiguous subsequence so that the following condition is satisfied:
- For every , the sum of elements in is divisible by .
Since the count can be enormous, print it modulo .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the number of ways to separate the sequence so that the condition in the Problem Statement is satisfied, modulo .
4
1 2 3 4
3
We have three ways to separate the sequence, as follows:
5
8 6 3 3 3
5
10
791754273866483 706434917156797 714489398264550 918142301070506 559125109706263 694445720452148 648739025948445 869006293795825 718343486637033 934236559762733
15
The values in input may not fit into a -bit integer type.