eolymp
bolt
Try our new interface for solving problems
Problems

Fibonacci numbers: the last digit

Fibonacci numbers: the last digit

The first who came closest

to solving the mystery of time

measurement on the planet Earth

was a great Fibonacci, though perhaps

he himself had no idea about it....

Find the last digit of the k-th Fibonacci number.

Fibonacci numbers are defined by the following recurrence relations:

prb4529

Input

Each line contains a single number k (0k9223372036854775807).

Output

For each test case print in a separate line the last digit of the k-th Fibonacci number.

Time limit 1 second
Memory limit 128 MiB
Input example #1
0
1
2
37
135
23
Output example #1
1
1
2
9
7
8
Author Анатолий Присяжнюк
Source Osipovsky Cup - 2013