407907: GYM102939 E Decryption Scheme

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

E. Decryption Schemetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

A new AI bot has taken over much of the world's most important computer infrastructures and threatens to reshape life for humans as we know it. You have been chosen as Earth's last hope to go through a series of logic and math puzzles which the AI has set in order to get to the control room and deactivate the bot.

You've reached the final puzzle and you find $$$5$$$ doors in front of you (labeled $$$0$$$, $$$1$$$, $$$2$$$, $$$3$$$, and $$$4$$$ because computers love $$$0$$$-indexing). The AI bot, confident that you won't be able to find the door leading to the control room, gives you a large integer $$$n$$$ and the following equation: $$$$$$1^n + 2^n + 3^n + 4^n \pmod{5}$$$$$$

If you can evaluate this expression for the given value of $$$n$$$, that will be the door the control room is behind. Calculate or choose wrong and you will be locked out of the building for good with no chance to stop the bot. Given $$$n$$$, choose the door that will save humanity.

Input

The only line of input contains a single integer $$$n$$$ where $$$0 \leq n \leq 10^{10^{5}}$$$.

Output

Output a single line representing the door that you should choose.

ExamplesInput
4
Output
4
Input
18417128371888291122782652113433
Output
0
Note

In the first sample, $$$1^4 + 2^4 + 3^4 + 4^4 = 1 + 16 + 81 + 256 = 354$$$ so $$$354 \pmod{5} = 4$$$.

加入题单

上一题 下一题 算法标签: