Problem H
RNG Test
Languages
en
is

As per usual an absolute truckload of random test data has to be generated for Forritunarkeppni Framhaldsskólanna to test solutions again. Since it’s not feasible to write all the data by hand KFFÍ uses random number generators. The head honchos at KFFÍ are paranoid about the quality of random number generator implementations, so they want to make their own. Atli was thus tasked with making a linear congruential generator. But because Atli overslept, as per usual, someone has to take care of this, that is to say you (as per usual).
A linear congruential generator is defined using three
integers
To get the
Input
The input consists of one line with five integers
Output
Print the
Scoring
Group |
Points |
Constraints |
1 |
40 |
|
2 |
20 |
|
3 |
20 |
|
4 |
20 |
|
Sample Input 1 | Sample Output 1 |
---|---|
10 3 42 42 1009 |
311 |
Sample Input 2 | Sample Output 2 |
---|---|
17 18 20 1000000000000000000 100003 |
41617 |
Sample Input 3 | Sample Output 3 |
---|---|
1 1 164 500000000000000000 1000000007 |
500000192 |