#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, w, x, y, z, A, B, ans;
  cin >> a >> b >> c >> d;
  w = a ^ b;
  x = c | d;
  y = b & c;
  z = a ^ d;
  A = w & x;
  B = y | z;
  ans = A ^ B;
  cout << ans;
  return 0;
}
