#P2429. 制杖题
制杖题
Description
Find the sum of all natural numbers not exceeding whose set of prime factors intersects the given set of primes.
Input Format
The first line contains two integers .
The second line contains integers , representing the elements of the prime set.
Output Format
Output one integer, the answer modulo .
2 15
3 5
60
Hint
Sample explanation: All qualifying numbers are , and their sum is .
| Test point ID | Constraints |
|---|---|
| , | |
| , | |
| , |
For the first of the testdata, .
For the remaining of the testdata, ,.
Translated by ChatGPT 5
京公网安备 11011102002149号