# 【百炼oj】2787:算24

5 5 5 1
1 1 4 2
0 0 0 0


YES
NO

/*24点*/
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<math.h>
#define MIN 0.000001
using namespace std;
double num[4];
int mark;
double operate(double a,double b,int k){
double result=0;
switch(k){
case 0:result=a+b;break;
case 1:result=a-b;break;
case 2:result=a*b;break;
case 3:if(b!=0)result=a/b;break;
case 4:result=b-a;break;
case 5:if(a!=0)result=b/a;
}
return result;
}

int func(int i,int j,int k){
if(fabs(operate(operate(operate(num[0],num[1],i),num[2],j),num[3],k)-24.0)<=MIN)return 1;
if(fabs(operate(operate(num[0],num[1],i),operate(num[2],num[3],j),k)-24.0)<=MIN)return 1;
return 0;
}

void check(double*num){
int i,j,k;
for(i=0;i<6;i++){
for(j=0;j<6;j++){
for(k=0;k<6;k++){
if(func(i,j,k)){
mark=1;
return;
}
}
}
}
}

int main(){
while(1){
int i;
mark=0;
for(i=0;i<4;i++)scanf("%lf",&num[i]);
if(num[0]==0)break;
sort(num,num+4);
check(num);
while(next_permutation(num,num+4)){
check(num);
}
if(mark==1)printf("YES\n");
else printf("NO\n");
}
return 0;
}