#abc164d. [abc164_d]Multiple of 2019
[abc164_d]Multiple of 2019
Problem Statement
Given is a string consisting of digits from 1
through 9
.
Find the number of pairs of integers () that satisfy the following condition:
Condition: In base ten, the -th through -th characters of form an integer that is a multiple of .
Constraints
- is a string consisting of digits from
1
through9
.
Input
Input is given from Standard Input in the following format:
Output
Print the number of pairs of integers () that satisfy the condition.
Sample Input 1
1817181712114
Sample Output 1
3
Three pairs - , , and - satisfy the condition.
Sample Input 2
14282668646
Sample Output 2
2
Sample Input 3
2119
Sample Output 3
0
No pairs satisfy the condition.