#include <stdio.h>
#include <stdlib.h>
int getA ( int n )
{
if ( n == 1 || n == 2 )
{
return 1;
}
else
{
return 2 * getA ( n - 1 ) + getA ( n - 2 );
}
}
int getS ( int n )
{
int i, s = 0;
for ( i = 1; i <= n; i++ )
{
s += getA ( i );
}
return s;
}
int main()
{
int j, k = 100;
while ( k <= 10000 )
{
for ( j = 1; j < 10000; j++ )
{
if ( getS ( j ) < k && getS ( j + 1 ) >= k )
{
printf ( "%d\n", j );
break;
}
}
k *= 10;
}
return 0;
}