#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[4];
  for (int i = 0; i <= 3; i++) cin >> a[i];
  int ans = ((a[0] ^ a[1]) & (a[2] | a[3])) ^ ((a[1] & a[2]) | (a[0] ^ a[3]));
  cout << ans;
  return 0;
}
