#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
    int a, b; cin>>a>>b;
    int res=1<<30;
    for(int i=0; i<10000; ++i) {
        for(int j=0; j<10000; ++j) if (i+j) {
            int x=i*1000/(i+j);
            int y=j*1000/(i+j);
            if (10*a-5<=x and x<=10*a+4 and 10*b-5<=y and y<=10*b+4)
                res=min(res, i+j);
        }
    }
    cout<<res<<endl;
}