Fibonacci words are defined in a way similar to Fibonacci numbers:
FIB1=b,FIB2=a,FIBk+2=FIBk+1⊕FIBk(k≥1)
where ⊕ denotes concatenation of two words.
The first few Fibonacci words are therefore FIB3=ab, FIB4=aba, FIB5=abaab, FIB6=abaababa.
You are given a pattern word made only of the letters a and b, together with an integer n. Count how many times the pattern appears as a contiguous fragment of the n-th Fibonacci word FIBn. Two occurrences may overlap, so every starting position whose fragment equals the pattern is counted separately.
The first line contains the pattern word. It consists of between 1 and 30 characters, each of which is a or b.
The second line contains one positive integer n with n≤200.
Print one nonnegative integer: the number of times the pattern word appears in FIBn. The answer can be very large and may not fit in a 64-bit integer.