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

long long int r;

int main(){
	scanf("%lld", &r);

		long long int f1 = 0;
		long long int f2 = 1;
		long long int tmp = r;
		int i = 10;
		while(tmp > 0){
			tmp/=10;
			i*=10;
		}
		long long int k = 0;
		while(f1 != r && k < 1000000000000000000LL){
			tmp = f1+f2;
			f1 = f2;
			f2 = tmp%i;
			k++;
		}
		if(k <  1000000000000000000LL){
			printf("%lld", k);
		}else{
			printf("NIE");
		}
}