#include <bits/stdc++.h>
using namespace std;
int fs(void) {
  bool negative = false;
  register int c;
  int num = 0;
  c = getchar();
  if (c == '-') {
    negative = true;
    c = getchar();
  }
  for (; c >= 48 && c <= 57; c = getchar()) {
    num = (num << 1) + (num << 3) + c - 48;
  }
  if (negative == true) {
    num *= -1;
  }
  return num;
}
int main(void) {
  long long a, b, c, d;
  cin >> a >> b >> c >> d;
  if (c == 0) {
    if (a == d)
      cout << 1 << endl;
    else
      cout << 0 << endl;
  } else if (c != 0) {
    if (a == d && a != 0)
      cout << 1 << endl;
    else
      cout << 0 << endl;
  }
  return 0;
}
