//类似深度搜索
let status;
while(line = readline()) {
    let arr = line.split(' ').map(x => parseInt(x));
    status = false;
    dfs(-1, 0, arr, status);
    print(status);
}

function dfs(step, pre, arr) {
    if (step == 3) {
        if (pre == 24) {
            status = true;
            return;
        }
    } else {
        step++;
        for (let key in arr) {
            let newArr = JSON.parse(JSON.stringify(arr));
            let num = newArr.splice(key, 1)[0];
            dfs(step, pre+num, newArr);
            dfs(step, pre-num, newArr);
            dfs(step, pre*num, newArr);
            dfs(step, pre/num, newArr);
        }
        return;
    }
}