import java.util.Scanner;
public class Main {
public static boolean[] visited = new boolean[4];
public static int[] nums = new int[4];
public static boolean flag = false;
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
while (in.hasNext()) {
for(int i=0;i<4;i++){
nums[i] = in.nextInt();
}
dfs(0,0);
System.out.println( flag == true );
}
}
public static void dfs(int start,double sum){
//终止条件
if(start==4){//搜索深度,四个数都所搜过了 0 1 2 3
if(sum == 24){
flag = true;
}
}else{
start++;
for(int i=0;i<4;i++){
if(!visited[i]){
visited[i] = true;//标记访问过,避免重复访问
dfs(start,sum + nums[i]);
dfs(start,sum - nums[i]);
dfs(start,sum * nums[i]);
dfs(start,sum / nums[i]);//nums[i] 取1 - 10
visited[i] = false;//回溯
}
}
}
}
}