#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 10;
const long long M = 1e7;
const long long mod = 1e9 + 7;
const long long INF = 1e18;
const long long inf = -1e18;
bool isprime(long long x) {
  if (x == 1) return false;
  long long y = sqrt(x);
  for (int i = 2; i <= y; i++) {
    if (x % i == 0) {
      return false;
    }
  }
  return true;
}
long long bin_pow(long long a, long long b) {
  if (b == 0) return 1;
  if (b == 1) return a;
  if (a == 0) return 0;
  if (a == 1) return a;
  if (b % 2 == 0) {
    long long pw = bin_pow(a, b / 2);
    return pw * pw;
  } else {
    return bin_pow(a, b - 1) * a;
  }
}
long long a[14];
int main() {
  cin >> a[1] >> a[2] >> a[3] >> a[4];
  if (a[3] == 0) {
    if (a[1] == a[4])
      cout << 1;
    else {
      cout << 0;
    }
  } else {
    if (a[1] != a[4]) {
      cout << 0;
    } else {
      if (a[1] == 0)
        cout << 0;
      else
        cout << 1;
    }
  }
}
