Under construction

Still being built. Things may change

Fibonacci Strings

Time limit2sMemory limit1024 MB

Summary
Given k (0 to 80), find the length of the longest palindrome that appears as a substring of the k-th Fibonacci string.
Level

Medium6 of 10

Topics
Recursion, String, Math
Solved
No attempts yet

Statement

Alla loves palindromes. Her name is a palindrome itself. A string is a palindrome if it reads the same from left to right and from right to left.

One day a teacher at school told Alla about so-called Fibonacci strings.

Fibonacci strings are defined as follows:

  • f0=af_0 = a
  • f1=bf_1 = b
  • fn=fn−1fn−2f_n = f_{n-1} f_{n-2} for every n≥2n \ge 2, the concatenation of the two previous Fibonacci strings.

So the first five Fibonacci strings are a, b, ba, bab, and babba.

Alla wants to know the longest palindrome that appears in the kk-th Fibonacci string. Help her solve this problem.

Input

The first line contains one integer kk (0≤k≤800 \le k \le 80), the index of the Fibonacci string.

Output

Print the length of the longest palindrome contained in the kk-th Fibonacci string.

Examples2

  1. Example 1

    Input
    2
    
    Expected output
    1
    
  2. Example 2

    Input
    4
    
    Expected output
    4