#include <bits/stdc++.h>
namespace io {
inline long long read() {
  long long x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * f;
}
char F[200];
inline void write(long long x) {
  if (x == 0) return (void)(putchar('0'));
  long long tmp = x > 0 ? x : -x;
  if (x < 0) putchar('-');
  int cnt = 0;
  while (tmp > 0) {
    F[cnt++] = tmp % 10 + '0';
    tmp /= 10;
  }
  while (cnt > 0) putchar(F[--cnt]);
}
}  // namespace io
using namespace io;
using namespace std;
int a[4];
int main() {
  for (int i = 0; i < 4; ++i) a[i] = read();
  if (a[0] == a[3]) {
    if (a[0] && a[2])
      puts("1");
    else if (a[0] && !a[2])
      puts("1");
    if (!a[0] && a[2])
      puts("0");
    else if (!a[0] && !a[2])
      puts("1");
  } else
    puts("0");
}
