Time limit: 0.05s
Memory limit: 64MB
Input: kfib.in
Output: kfib.out
Task
Given a natural number , find the term of the Fibonacci sequence, modulo .
Input data
The first line of the file kfib.in
contains the natural number .
Output data
The first line of the file kfib.out
will contain the answer to this task.
Constraints and clarifications
Example 1
kfib.in
6
kfib.out
8
Explanation
The first terms of the Fibonacci sequence are:
The term is .
Example 2
kfib.in
123456789
kfib.out
62791945