Cipher

Time limit1sMemory limit128 MB

Summary
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 nn, mm, and the intruder must very quickly report the last digits of the consecutive Fibonacci numbers from fib(n)fib(n) up to fib(m)fib(m). The Fibonacci numbers are defined by fib(1)=1fib(1) = 1, fib(2)=1fib(2) = 1, and fib(n)=fib(n−1)+fib(n−2)fib(n) = fib(n-1) + fib(n-2) for n>2n > 2. The first two terms are both 1, and each following term is the sum of the two preceding ones, so the sequence begins 1,1,2,3,5,8,13,…1, 1, 2, 3, 5, 8, 13, \dots. Write a program that helps Limak.

Input

The first and only line contains two natural numbers nn, mm (0<n<m<1070 < n < m < 10^7), separated by a single space.

Output

In the first and only line, output the last (least significant) digit of each Fibonacci number from fib(n)fib(n) up to fib(m)fib(m), concatenated in order. The digits must not be separated by any characters.

Examples1

  1. Example 1

    Input
    3 5
    
    Expected output
    235