#include <bits/stdc++.h>
using namespace std;
int main() {
  bool a, b, c, d, p, q, r, s, t, u, v;
  cin >> a >> b >> c >> d;
  p = (a != b);
  q = (c || d);
  r = (b && c);
  s = (a != d);
  t = (p && q);
  u = (r || s);
  v = (u != t);
  if (v)
    cout << 1;
  else
    cout << 0;
  return 0;
}
