#include <bits/stdc++.h>
using namespace std;
int main() {
  int X1, X2, X3, X4;
  cin >> X1 >> X2 >> X3 >> X4;
  int A = X1 ^ X2, B = X3 | X4, C = X2 & X3, D = X1 ^ X4;
  int X = A & B, Y = C | D;
  int ans = X ^ Y;
  cout << ans << "\n";
  return 0;
}
