#P8022. [ONTAK2015] Cięcie
[ONTAK2015] Cięcie
Problem Description
Given a digit string of length and three prime numbers , split into three non-empty substrings such that the first substring is divisible by , the second substring is divisible by , and the third substring is divisible by , and none of the three substrings has a leading .
Note: A single digit is allowed.
Input Format
The first line contains four integers .
The second line contains a digit string of length .
Output Format
Output one integer, the total number of valid splitting ways.
19 2017 2027 2029
2017202741127832029
2
Hint
For of the testdata, , , and are prime numbers.
Translated by ChatGPT 5