## Lu Han and Birthday

View as PDF

Points: 10 (partial)
Time limit: 1.0s
Memory limit: 512M

Author:
Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

Lu Han, EXO member and K-pop idol wakes up to find that it's his birthday, April 20! Following his birthday tradition, he starts to reread his favourite book.

### Problems bobhob314 Failed

#### Author: Scoop God, God of Scooping

Given integers , , and , determine the sum, for all primes such that , of the sum of every multiple of each prime, such that . That is, you are taking a sum of sums, and each sum is of a prime's multiples. The only line of input will contain four space-separated integers , , , as described. Print the required sum as output. Reason for failing: Wasn't sure whether or not to modulo the final answer. Please do not perform as he/she did, and instead, please modulo the answer by .

Lu Han Solo now continues his birthday tradition by copying code, in the spirit of bobhob314 himself. Helpfully submit your code to him via this problem, and you will be rewarded with some points!

#### Constraints

, , .

No further constraints.

#### Input

One line with four space-separated integers , , , .

#### Output

One integer, the required answer modulo .

#### Sample Input

2 3 2 10

#### Sample Output

48

#### Explanation

2 and 3 are the only primes in the range . The multiples of 2 in the range are 2, 4, 6, 8 and 10. Likewise, The multiples of 3 in the range are 3, 6 and 9. The sum of these numbers is equal to 48, unless the aforementioned book needs a sequel already.