#include <bits/stdc++.h>
using namespace std;
int main(int argc, char **argv) {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0), cout.precision(15);
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int A = (a ^ b) & (c | d);
  int B = (b & c) | (a ^ d);
  cout << (A ^ B) << endl;
  return 0;
}
