import java.util.*;
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 sc = new Scanner(System.in);
            while(sc.hasNext()){
                for(int i=0;i<4;i++){
                    nums[i]=sc.nextInt();
                }
                dfs(0,0);
                System.out.println(flag);
            }
        }
        public static void dfs(int start,double sum){
            //递归终止条件, start表示当前的位置 如果四个数字都遍历完了 最后start=4
            if(start==4){
                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]);
                        visited[i]=false;
                    }
                }
            }
        }
}