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
#include <cstdio>
#include <algorithm>
#include <vector>

using namespace std;

int n;
long long x;

int readint()
{
    int res=0;
    char s;
    while(1)
    {
        s=getchar();
        if(isspace(s)) return res;
        res=10*res+s-'0';
        n++;
    }
}

int main()
{
    unsigned long long a=0, b=1, c;
    x=readint();
    unsigned long long mod=1;
    for(int i=0; i<n; i++)
        mod=(mod<<3)+(mod<<1);
    long long id=-1;
    for(unsigned long long i=2; i<=15*mod/10; i++)
    {
        c=(a+b)%mod;
        a=b;
        b=c;
        if(c==x) id=i;
    }
    if(id==-1) printf("NIE\n");
    else printf("%llu",id+15*mod/10);

	return 0;
}