#include <bits/stdc++.h>
using namespace std;
inline void read(int &x) {
  x = 0;
  int f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c <= '9' && c >= '0') {
    x = (x << 1) + (x << 3) + (c ^ 48);
    c = getchar();
  }
  x *= f;
}
inline void print(int x) {
  if (x < 0) {
    x = -x;
    putchar('-');
  }
  if (x > 9) print(x / 10);
  putchar(x % 10 + '0');
}
int gcd(int a, int b) {
  while (b ^= a ^= b ^= a %= b)
    ;
  return a;
}
int pri[55555];
int miu[55555];
void work(int n) {
  miu[1] = 1;
  for (register int i = 2; i <= n; i++) {
    if (!pri[i]) pri[++pri[0]] = i, miu[i] = -1;
    for (register int j = 1; j <= pri[0] && i * pri[j] <= n; j++) {
      pri[pri[j] * i] = 1;
      if (i % pri[j] == 0)
        break;
      else
        miu[i * pri[j]] = -miu[i];
    }
  }
}
int main() {
  int a, b, c, d;
  read(a);
  read(b);
  read(c);
  read(d);
  print(((a ^ b) & (c | d)) ^ ((b & c) | (a ^ d)));
}
