AT_abc421_b [ABC421B] Fibonacci Reversed
Description
For a positive integer $ x $ , define $ f(x) $ as follows:
- Let $ s_x $ be the string obtained by representing $ x $ in decimal notation (without leading zeros), and let $ \text{rev}(s_x) $ be the string obtained by reversing $ s_x $ . The value of $ f(x) $ is the integer obtained by interpreting $ \text{rev}(s_x) $ as a decimal representation of an integer.
For example, when $ x=13 $ , we have $ \text{rev}(s_x)= $ `31`, so $ f(x)=31 $ ; when $ x=10 $ , we have $ \text{rev}(s_x)= $ `01`, so $ f(x)=1 $ . Particularly, for any positive integer $ x $ , the value of $ f(x) $ is a positive integer.
You are given positive integers $ X $ and $ Y $ . Define a sequence of positive integers $ A=(a_1,a_2,\dots,a_{10}) $ as follows:
- $ a_1 = X $
- $ a_2 = Y $
- $ a_i = f(a_{i-1}+a_{i-2})\ (i\geq 3) $
Find the value of $ a_{10} $ .
Input Format
The input is given from Standard Input in the following format:
> $ X $ $ Y $
Output Format
Print the value of $ a_{10} $ .
Explanation/Hint
### Sample Explanation 1
The values of the elements of $ A $ are as follows:
- $ a_1=1 $
- $ a_2=1 $
- $ a_3=2 $
- $ a_4=3 $
- $ a_5=5 $
- $ a_6=8 $
- $ a_7=31 $
- $ a_8=93 $
- $ a_9=421 $
- $ a_{10}=415 $
Thus, print $ 415 $ .
### Constraints
- $ 1\leq X,Y \leq 10^5 $
- All input values are integers.