#include <bits/stdc++.h>
using namespace std;
const int N = 200011;
long long daraja(long long n, long long k) {
  if (k == 0) return 1;
  long long x = (daraja(n, k / 2)) * (daraja(n, k / 2));
  if (k % 2 == 1) x *= n;
  return x;
}
int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if (a == d) {
    if (a == 0 && d == 0 && c != 0)
      cout << 0;
    else
      cout << 1;
  } else
    cout << 0;
  return 0;
}
