Submit solution

Points:
7 (partial)

Time limit:
1.0s

Memory limit:
16M

Python
128M

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

Molly has a math addiction. For her birthday, she receives a sequence of length defined by . Given the value of , help Molly find the sum of all pairwise products, mod .

#### Input Specification

The first and only line of input will contain , , , and , each space-separated.

#### Output Specification

The output should contain a single integer, the sum of all pairwise products, mod .

#### Constraints

For all subtasks,

##### Subtask 1 [40%]:

##### Subtask 2 [40%]:

##### Subtask 3 [20%]:

#### Sample Input

`3 6 3 100`

#### Sample Output

`2808`

#### Explanation for Sample Output

The three numbers are , , and . Their pairwise products are , , , , and and their sum is .

## Comments