Question: If anyone can help understand how i solve this Batmanacci The Fibonacci sequence can be defined as follows: fib1fib2fibn=1=1=fibn2+fibn1fib1=1fib2=1fibn=fibn2+fibn1 We get the sequence 1,1,2,3,5,8,13,21,1,1,2,3,5,8,13,21,. But

If anyone can help understand how i solve this

Batmanacci

The Fibonacci sequence can be defined as follows:

fib1fib2fibn=1=1=fibn2+fibn1fib1=1fib2=1fibn=fibn2+fibn1

We get the sequence 1,1,2,3,5,8,13,21,1,1,2,3,5,8,13,21,. But there are many generalizations of the Fibonacci sequence. One of them is to start with other numbers, like:

f1f2fn=5=4=fn2+fn1f1=5f2=4fn=fn2+fn1

And we get the sequence 5,4,9,13,22,35,57,5,4,9,13,22,35,57,. But what if we start with something other than numbers? Let us define the Batmanacci sequence in the following manner:

s1s2sn=N=A=sn2+sn1s1=Ns2=Asn=sn2+sn1

where ++ is string concatenation. Now we get the sequence N, A, NA, ANA, NAANA, .

Given NN and KK, what is the KK-th letter in the NN-th string in the Batmanacci sequence?

Input

Input consists of a single line containing two integers NN (1N1051N105) and KK (1K10181K1018). It is guaranteed that KK is at most the length of the NN-th string in the Batmanacci sequence.

Output

Output the KK-th letter in the NN-th string in the Batmanacci sequence.

Sample Input 1 Sample Output 1
7 7 
N

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!