#include <bits/stdc++.h>
using namespace std;
const long long INF = LLONG_MAX - 1e10;
const long long maxn = 1e6 + 5;
const long long mo_num = 1e9 + 7;
long long n, m, a[maxn], b[maxn], ans;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  for (long long i = 1; i <= 4; i++) cin >> a[i];
  long long key = 0;
  if (a[1] == a[4]) {
    if (!a[3])
      key = 1;
    else if (a[1] > 0)
      key = 1;
  }
  cout << key ? 1 : 0;
  return 0;
}
