单点时限: 2.0 sec
内存限制: 512 MB
… Why don’t you come to the planetarium?
The beautiful twinkling of eternity that will never fade, no matter what.
All the stars in the sky are waiting for you…
A planetarium, it was once where people went to soothe their hearts by gazing at a starry sky.
And Yumemi, a planetarium guide who has been waiting for a visitor for a long time, is looking up at the stars.
Stars in the sky can be defined by their brightness, denoted by
Yumemi found that stars always appear in groups, and she thinks the beauty of the starry night depends on the darkest one, so she defined the beauty value as
where
But the night sky is not always the same. The movement of celestial bodies will make more and more stars in the night sky. The following events will happen in order every second:
At the beginning, there is no star in the sky, so
As time goes by, because she is not as good at calculation as before, the task will be given to you.
Note that the sequence is given in a modified way.
To avoid huge input, we use Linear Congruential Method to generate input data, and your solution should be on-line.
The first line contains six integers
You need to generate the sequence
where
To avoid huge output, you only need to output
5 13 2 0 1 3
27
In the first second,
It can be inferred that
In the second second,
It can be inferred that
Keep calculating, and you will get
So you should output