4 31 41 59 -26 53 58 5 2 9 1 79 2 32 1 38 2 462
61 43 216 Initially, the values of the presents Takahashi is scheduled to receive are $59,-26,53,58$, in the order he will receive them. The five queries are as follows: * When his mood is initially $9$, his mood changes as $9\rightarrow40\rightarrow-1\rightarrow30\rightarrow61$ each time he receives a present, so print the final mood $61$. * A present with value $79$ is added to the presents he is scheduled to receive, and the values of the presents he is scheduled to receive become $59,-26,53,58,79$. * When his mood is initially $32$, his mood changes as $32\rightarrow63\rightarrow22\rightarrow53\rightarrow84\rightarrow43$ each time he receives a present, so print the final mood $43$. * A present with value $38$ is added to the presents he is scheduled to receive, and the values of the presents he is scheduled to receive become $59,-26,53,58,79,38$. * When his mood is initially $462$, his mood changes as $462\rightarrow421\rightarrow380\rightarrow339\rightarrow298\rightarrow257\rightarrow216$ each time he receives a present, so print the final mood $216$.
3 1000000000 1000000000 1000000000 0 -1000000000 3 2 -1000000000000 2 0 2 1000000000000
\-997000000000
-1000000000
997000000000
Note that the absolute value of the input and the values to be output may be $2 ^ {32}$ or greater.20 8489 1428 6312 -9511 1048 -5301 -2588 -7097 -3342 5209 7493 3378 -5300 6592 7862 -8118 8109 1116 5549 3953 9244 7773 10 1 1694 2 -9723 2 -5195 2 -1384 1 1149 2 9845 2 -7720 2 8329 2 -4652 2 -5672
9874 14402 8296 8180 10449 6664 3600 12497
{
"problem": {
"name": "Takahashi's Expectation 2",
"description": {
"content": "Takahashi will receive some presents from now on. He has an integer parameter called mood, and the mood changes each time he receives a present. Each present has an integer parameter called value $P$,",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 2000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "abc427_g"
},
"statements": [
{
"statement_type": "Markdown",
"content": "Takahashi will receive some presents from now on.\nHe has an integer parameter called mood, and the mood changes each time he receives a present. Each present has an integer parameter called value $P$,...",
"is_translate": false,
"language": "English"
}
]
}