#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=200005,INF=1<<30,D=1000000000;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll x1,x2;cin>>x1>>x2;
    map<int,int> MA,MA2,MA5;
    
    for(int i=0;i<10;i++){
        for(int j=0;j<10;j++){
            int a=1;
            for(int k=0;k<i;k++) a*=2;
            for(int k=0;k<j;k++) a*=5;
            
            MA[a]=i+j;
            MA2[a]=i;
            MA5[a]=j;
        }
    }
    
    int t=0;
    
    while(1){
        
        if((x1/2==x2&&x1==x2*2)||(x1/5==x2&&x1==x2*5)||(x1==x2/2&&x1*2==x2)||(x1==x2/5&&x1*5==x2)||(x1==D/4&&x2==D)){
            cout<<x2<<endl;
            return 0;
        }
        
        int pa=abs(MA[x1]-MA[x2])&1;
        
        if(x1==D&&pa) break;
        
        if(x1==D/2){
            if(pa){
                break;
            }else{
                cout<<D/4<<endl;
                x1=D/4;
            }
        }else if(x1==D/4){
            if(pa){
                break;
            }else{
                cout<<D<<endl;
                x1=D;
            }
        }else if(MA2[x1]>=8){
            cout<<x1/2<<endl;
            x1/=2;
        }else if(MA2[x1]<7){
            cout<<x1*2<<endl;
            x1*=2;
        }else{
            cout<<x1*5<<endl;
            x1*=5;
        }
        
        if(x1==x2) return 0;
        
        cin>>x2;
        
        t++;
        
        if(x1==x2) return 0;
    }
    
    while(1){
        
        if((x1/2==x2&&x1==x2*2)||(x1/5==x2&&x1==x2*5)||(x1==x2/2&&x1*2==x2)||(x1==x2/5&&x1*5==x2)||(x1==D/4&&x2==D)){
            cout<<x2<<endl;
            return 0;
        }
        
        int a=MA2[x1]-MA2[x2],b=MA5[x1]-MA5[x2];
        
        if(x1==D){
            cout<<x1/2<<endl;
            x1/=2;
        }else if(x1==D/2){
            cout<<x1/2<<endl;
            x1/=2;
        }else if(abs(a)==1){
            if(b>0){
                cout<<x1/5<<endl;
                x1/=5;
            }else{
                cout<<x1*5<<endl;
                x1*=5;
            }
        }else if(abs(b)==1){
            if(a>0){
                cout<<x1/2<<endl;
                x1/=2;
            }else{
                cout<<x1*2<<endl;
                x1*=2;
            }
        }else if(abs(a)&1){
            if(a>0){
                cout<<x1/2<<endl;
                x1/=2;
            }else{
                cout<<x1*2<<endl;
                x1*=2;
            }
        }else if(abs(b)&1){
            if(b>0){
                cout<<x1/5<<endl;
                x1/=5;
            }else{
                cout<<x1*5<<endl;
                x1*=5;
            }
        }
        
        cin>>x2;
        
        if(x1==x2) return 0;
        
        t++;
        
    }
}