#include <bits/stdc++.h>
const int inf = 1e8 + 7;
const long long mod = 1000000007;
const double eps = 1e-10;
using namespace std;
inline void read(int &x) { scanf("%d", &x); }
inline void readll(long long &x) { scanf("%lld", &x); }
int a, b, c, d;
int main() {
  cin >> a >> b >> c >> d;
  int x1 = a ^ b;
  int x2 = c | d;
  int x3 = b & c;
  int x4 = a ^ d;
  int x5 = x1 & x2;
  int x6 = x3 | x4;
  cout << (x5 ^ x6) << endl;
  return 0;
}
