#pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #include using namespace std; using lint = long long; int dist(lint x) { if (x == 0) return 100; int ret = 0; while (x % 5 == 0) x /= 5, ret++; return ret; } int main() { int N, E; cin >> N >> E; lint ret = -1; for (int current = 0; current <= (1 << 29); ++current) { if (dist(lint(current) * current - N) >= E) { ret = current; break; } } // assert(ret <= (1 << 29)); if (ret >= 0) { cout << ret << endl; } else { puts("NaN"); } }