#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define popcount __builtin_popcount using namespace std; typedef long long int ll; typedef pair P; struct R{ ll x, y; R(ll a, ll b){ ll g=gcd(a, b); x=a/g, y=b/g; } R(ll a):x(a), y(1){} R():x(0), y(1){} R operator+(R r){ return R(x*r.y+y*r.x, y*r.y); } R operator-(R r){ return R(x*r.y-y*r.x, y*r.y); } R operator*(R r){ return R(x*r.x, y*r.y); } R operator/(R r){ return R(x*r.y, y*r.x); } bool operator==(const R &r)const{ return x==r.x && y==r.y; } bool operator<(const R &r)const{ return x*r.y>a[i]; vector v; for(int i=1; i<=6; i++){ for(int j=0; j<=i; j++){ if(gcd(i, j)>1) continue; v.push_back(R(j, i)); } } int m=v.size(); int i[5]; ll ans=1e18; for(i[0]=0; i[0]