The input consists of four lines, each line containing a single digit 0 or 1.
none
0
1
1
0
0
0
0
0
0
0
1
0
0
0
1
0
1
0
0
0
1
1
0
0
1
0
0
1
0
0
1
0
1
0
0
1
1
1
0
1
0
0
0
1
1
1
0
0
1
1
0
1
0
1
0
1
1
0
1
0
0
0
1
1
1
1
0
1
1
1
0
1
1
1
0
1
1
1
1
1
#include<iostream>
using namespace std;
bool XOR(bool a,bool b){
    if(a==b){
        return false;
    }
    else{
        return true;
    }
}
bool OR(bool a,bool b){
    if(a==0&&b==0){
        return false;
    }
    else{
        return true;
    }
}
bool AND(bool a,bool b){
    if(a==1&&b==1){
        return true;
    }
    else{
        return false;
    }
}
int main(){
    bool a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<XOR(AND(XOR(a,b),OR(c,d)),OR(AND(b,c),XOR(a,d)))<<endl;
    return 0;
}