#include #include #include using namespace std; long gcd(long a,long b){return b?gcd(b,a%b):a;} pairnorm(long a,long b) { long g=gcd(a,b); if(g!=1)a/=g,b/=g; if(b<0)a=-a,b=-b; return make_pair(a,b); } set >M[1<<17]; int N; long A[7]; main() { cin>>N; for(int i=0;i>A[i]; M[1<&X:M[x]) { for(const pair&Y:M[y]) { M[i].insert(norm(X.first*Y.second+Y.first*X.second,X.second*Y.second)); M[i].insert(norm(X.first*Y.second-Y.first*X.second,X.second*Y.second)); M[i].insert(norm(-X.first*Y.second+Y.first*X.second,X.second*Y.second)); M[i].insert(norm(X.first*Y.first,X.second*Y.second)); M[i].insert(norm(X.first*Y.second,X.second*Y.first)); M[i].insert(norm(Y.first*X.second,Y.second*X.first)); } } if(y==0)break; } if(x==0)break; } } for(int i=1;i<1<&X:M[i]) { if(M[j].find(X)!=M[j].end()) { cout<<"YES"<