1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <iostream>
#include <string>

using namespace std;

long long toInt(string a)
{
    long long z = a[0]-'0';
    for(int i = 1 ; i < a.size() ; i++)
    z=z*10+a[i]-'0';

    return z;
}

long long pow(long long b)
{
    long long a = 10;
    for(int i = 1 ; i < b ; i ++)
    {
        a*=10;
    }
    return a;
}


int main()
{
    register int tab[] = {60,300,1500 , 15000 ,150000,1500000,15000000,150000000};
    register string xx;
    cin>>xx;
    register long long koniec = toInt(xx) ;
    register long long a = 0 , b =1 , mod=pow(xx.size());
    //cout<<koniec<<" "<<mod;

    for(register int i = 2 ; i < tab[xx.size()] ; i++)
    {
        b += a;
        a = b-a;
        if((b-koniec)%mod==0)
        {
            cout<<i;
            return 0;
        }
    }

    cout<<"NIE";



}