#define _USE_MATH_DEFINES #include using namespace std; #define FOR(i,m,n) for(int i=(m);i<(n);++i) #define REP(i,n) FOR(i,0,n) #define ALL(v) (v).begin(),(v).end() using ll = long long; const int INF = 0x3f3f3f3f; const ll LINF = 0x3f3f3f3f3f3f3f3fLL; const double EPS = 1e-8; const int MOD = 1000000007; // const int MOD = 998244353; const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1}; const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1}; template inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; } template inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; } struct IOSetup { IOSetup() { cin.tie(nullptr); ios_base::sync_with_stdio(false); cout << fixed << setprecision(20); } } iosetup; pair f(int x) { int a = 0, b = 0; while (x % 2 == 0) { ++a; x /= 2; } while (x % 5 == 0) { ++b; x /= 5; } return {a, b}; } int g(pair p) { auto [a, b] = p; int res = 1; REP(_, a) res *= 2; REP(_, b) res *= 5; return res; } int dist(pair p1, pair p2) { return abs(p1.first - p2.first) + abs(p1.second - p2.second); } int main() { int x1, x2; cin >> x1 >> x2; auto p1 = f(x1); while (p1.first != 7) { p1.first += p1.first > 7 ? -1 : 1; x1 = g(p1); cout << x1 << endl; if (x1 == x2) return 0; cin >> x2; if (x1 == x2) return 0; } while (p1.second != 9) { ++p1.second; x1 = g(p1); cout << x1 << endl; if (x1 == x2) return 0; cin >> x2; if (x1 == x2) return 0; } auto p2 = f(x2); if (dist(p1, p2) & 1) { x1 = 500000000; cout << x1 << endl; if (x1 == x2) return 0; cin >> x2; if (x1 == x2) return 0; } x1 = 1000000000; p1 = {9, 9}; cout << x1 << endl; if (x1 == x2) return 0; cin >> x2; if (x1 == x2) return 0; p2 = f(x2); while (true) { (p1.first - p2.first > p1.second - p2.second ? p1.first : p1.second) -= 1; x1 = g(p1); cout << x1 << endl; if (x1 == x2) return 0; cin >> x2; p2 = f(x2); if (x1 == x2) return 0; } }