#include <bits/stdc++.h>
using namespace std;
int main() {
  bool a, b, c, d;
  cin >> a >> b >> c >> d;
  if (((a ^ b) && (c || d)) ^ ((b && c) || (a ^ d)))
    cout << 1 << endl;
  else
    cout << 0 << endl;
  return 0;
}
