import java.util.Scanner;
public class Main {
private static int isSolve = 0;
public static void dfs(int index,int currentNum,int[] arr){
if(currentNum == 24){
isSolve = 1;
return;// 结束递归
}
if(isSolve == 1 || currentNum > 24 || index >= 4)
{
return ;
}
for(int i = 0; i < 4;i++){
switch (i){
case 0:
dfs(index+1,currentNum - arr[index],arr);
break;
case 1:
dfs(index+1,currentNum + arr[index],arr);
break;
case 2:
dfs(index+1,currentNum * arr[index],arr);
break;
case 3:
dfs(index+1,currentNum / arr[index],arr);
break;
}
if(isSolve == 1) return;
}
}
public static void getAllOrder(int[] array,int start,int end){
// 递归出口
if(start == end){
dfs(1,array[0],array);
return;
}else{
for(int i = start;i < end;i++){
getAllOrder(array,start + 1,end);
swap(array,start,i);
}
}
}
// 交换两个元素的位置
private static void swap(int[] array,int i,int j){
if(i == j){
return;
}
int temp = temp = array[i];
array[i] = array[j];
array[j] = temp;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while(sc.hasNextInt()){
int[] num = new int[4];
for(int i = 0 ; i <= 3; i++)
num[i] = sc.nextInt();
// String temp = sc.nextLine();
// 调用的数据要有一个全排列,这样才能保证全部情况都出现了,否则有可能漏掉
getAllOrder(num,0,4);
System.out.println(isSolve == 1 ? true : false +"");
// System.out.println((flag == true ? true :false) +"");
}
}
}