You are given four integers: , , , . You will use them in order to create the sequence with the following pseudo-code.
a = S (modulo 2^31) for i = 1 to N-1 a[i] = a[i-1]*P+Q (modulo 2^31)
Your task is to calculate the number of distinct integers in the sequence .
Four space separated integers on a single line, , , , and respectively.
A single integer that denotes the number of distinct integers in the sequence .
3 1 1 1
Hence, there are different integers in the sequence.