#include <bits/stdc++.h>
using namespace std;
long long read() {
  long long X = 0, w = 0;
  char ch = 0;
  while (!isdigit(ch)) {
    w |= ch == '-';
    ch = getchar();
  }
  while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
  return w ? -X : X;
}
int i1, i2, i3, i4, ians;
int main() {
  i1 = read();
  i2 = read();
  i3 = read();
  i4 = read();
  ians = ((i1 ^ i2) & (i3 | i4)) ^ ((i2 & i3) | (i1 ^ i4));
  printf("%d", ians);
  return 0;
}
