#include <cstdio>
#include <cstring>
#include <math.h>
using namespace std;
long long a, b=0, c=1, okr, i, mod, wzor=0;
long long potega10 (short int x)
{
long long pot=1;
for (short int k=0; k<x; k++)
pot*=10;
return pot;
}
int main()
{
char ciag[20];
scanf ("%s", ciag);
short int l=strlen (ciag);
switch (l)
{
case 1:
okr=60;
break;
case 2:
okr=300;
break;
default:
okr=15*potega10 (l-1);
break;
}
for (short int j=l-1; j>=0; j--)
{
wzor+=(ciag[j]-'0')*potega10 (l-1-j);
}
mod=pow (10, l);
for (i=2; i<okr+2&&c!=wzor; i++)
{
a=b;
b=c;
c=(a+b)%mod;
}
i--;
if (c==wzor)
{
if (ciag[0]=='0'&&c<mod)
i+=okr;
printf ("%lld", i);
}
else
printf ("NIE");
return 0;
}