#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int power(int a, int b, int p) {
  int ans = 1 % p;
  for (; b; b >>= 1) {
    if (b & 1) ans = (long long)ans * a % p;
    a = (long long)a * a % p;
  }
  return ans;
}
int a, b, c, d;
int main() {
  scanf("%d%d%d%d", &a, &b, &c, &d);
  if (a == d && (a != 0 || c == 0))
    printf("1\n");
  else
    printf("0\n");
  return 0;
}
