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
#include <cstdio>
int main() {
	unsigned long long int a = 0, b = 1, c, d, mod = 1;
	scanf("%llu", &d);
	while (mod <= d) {
		mod *= 10;
	}
	int i = 0;
	while (i++ < 30000000) {
		c = (a + b)%mod;
		// c %= mod;
		if (c == d) {
			printf("%llu\n", c);
			return 0;
		}
		a = c;
		c = (a + b)%mod;
		// c %= mod;
		if (c == d) {
			printf("%llu\n", c);
			return 0;
		}
		b = c;
	}
	printf("NIE\n");
}