#include <bits/stdc++.h>
using namespace std;
int main() {
  long long i, j, n, k, ans = 1, a = 0, b = 0;
  cin >> i >> j >> n >> k;
  a = n % 2;
  if (i == k) {
    if (n && i == 0) ans = 0;
  } else
    ans = 0;
  cout << ans;
}
