#include using namespace std; using lint = long long int; using P = pair; using PL = pair; #define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i=i##_begin_;i--) #define REP(i, n) FOR(i,0,n) #define IREP(i, n) IFOR(i,0,n) #define ALL(a) (a).begin(),(a).end() constexpr int MOD = 1000000007; constexpr int INF = 2147483647; void yes(bool expr) {cout << (expr ? "Yes" : "No") << "\n";} void outnum(int two, int five) { int ans = 1; REP(i, two) ans *= 2; REP(i, five) ans *= 5; cout << ans << "\n"; cout.flush(); } int gettwo(int num) { int two = 0; while(num%2 == 0) { num /= 2; two++; } return two; } int getfive(int num) { int five = 0; while(num%5 == 0) { num /= 5; five++; } return five; } int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int x1, x2; cin >> x1 >> x2; int two1 = gettwo(x1); int five1 = getfive(x1); int two2 = gettwo(x2); int five2 = getfive(x2); while(true) { if((abs(two1-two2) + abs(five1-five2))%2 == 0) { if(two1 < 7) two1++; else if(two1 > 7) two1--; else if(five1 < 9) five1++; else two1 += 2; } else { if(five1 == five2 && abs(two1-two2) == 1) two1 = two2; else if(two1 == two2 && abs(five1-five2) == 1) five1 = five2; else if(abs(two1-two2) > abs(five1-five2)) { if(two1 > two2) two1--; else two1++; } else { if(five1 > five2) five1--; else five1++; } } outnum(two1, five1); if(two1 == two2 && five1 == five2) break; cin >> x2; two2 = gettwo(x2); five2 = getfive(x2); if(two1 == two2 && five1 == five2) break; } }