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
#include <iostream>
using namespace std;
unsigned long long int l, a, b, pom, szukana, modulo;
string s;
int i;

int main() 
{
	cin >> s;
	modulo = 1;
	for(i = 0; i < s.size(); i++)
	{
		szukana *= 10;
		modulo *= 10;
		szukana += s[i] - '0';
	}
	
	a = 1;
	b = 1;
	l = 2;
	
	while(b != szukana)
	{
		l++;
		pom = b;
		b = a + b;
		b %= modulo;
		a = pom;
		if (l == 50000000)
		{
			cout << "NIE" << endl;
			return 0;
		}
	}
	
	cout << l << endl;
	
return 0;
}