#include <bits/stdc++.h>
using namespace std;
long long fac[1000006];
long long power(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long modInverse(long long n, long long p) { return power(n, p - 2, p); }
long long nCr(long long n, long long r, long long p) {
  if (r == 0) return 1;
  return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) %
         p;
}
void sol() {
  long long c1, c2, c3, c4;
  cin >> c1 >> c2 >> c3 >> c4;
  if (c1 == c4) {
    if (c3 > 0 && c1 == 0)
      cout << 0;
    else
      cout << 1;
  } else
    cout << 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  while (t--) {
    sol();
  }
  return 0;
}
