Cipher
Time limit1sMemory limit128 MB
Given n and m, print the units digits of fib(n) through fib(m) concatenated with no separators.
- Level
Medium4 of 10
- Topics
- Math, Implementation, Number theory, Simulation
- Solved
- No attempts yet
Problem
Limak is breaking into the Compute-Anything System. Its security relies on an extremely strong password scheme that Limak has already cracked. The scheme works as follows: the computer gives a pair of numbers , , and the intruder must very quickly report the last digits of the consecutive Fibonacci numbers from up to . The Fibonacci numbers are defined by , , and for . The first two terms are both 1, and each following term is the sum of the two preceding ones, so the sequence begins . Write a program that helps Limak.
Input
The first and only line contains two natural numbers , (), separated by a single space.
Output
In the first and only line, output the last (least significant) digit of each Fibonacci number from up to , concatenated in order. The digits must not be separated by any characters.