#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T &x) {
  int f = 1;
  char k = getchar();
  x = 0;
  for (; k > '9' || k < '0'; k = getchar())
    if (k == '-') f = -1;
  for (; k >= '0' && k <= '9'; k = getchar()) x = x * 10 + k - '0';
  x *= f;
}
int a, b, c, d;
int main() {
  read(a);
  read(b);
  read(c);
  read(d);
  printf("%d", ((a ^ b) & (c | d)) ^ ((b & c) | (a ^ d)));
  return 0;
}
