#include <bits/stdc++.h>
using namespace std;
int read() {
  int f = 1, x = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -f;
    c = getchar();
  }
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
  return f * x;
}
int a, b, c, d;
void init() { a = read(), b = read(), c = read(), d = read(); }
void solve() {
  if (a > d) swap(a, d);
  if (a != d)
    printf("0\n");
  else {
    if (a == 0 && d == 0 && c != 0)
      printf("0\n");
    else
      printf("1\n");
  }
}
int main() {
  init();
  solve();
  return 0;
}
