#include <bits/stdc++.h>
using namespace std;
inline int gcd(int x, int y) {
  if (!y) return x;
  return gcd(y, x % y);
}
inline void read(int &x) {
  char ch;
  int N = 1;
  while ((ch = getchar()) && (!((ch >= '0') && (ch <= '9'))) && (!(ch == '-')))
    ;
  if ((ch == '-')) {
    N = -1;
    while ((ch = getchar()) && (!((ch >= '0') && (ch <= '9'))))
      ;
  }
  x = ch - 48;
  while ((ch = getchar()) && (((ch >= '0') && (ch <= '9'))))
    x = x * 10 + ch - 48;
  x *= N;
}
int a, b, c, d;
int main() {
  read(a);
  read(b);
  read(c);
  read(d);
  printf("%d\n", ((a ^ b) & (c | d) ^ ((b & c) | (a ^ d))));
}
