#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
int main() {
  ios_base::sync_with_stdio(0);
  long long cnt1, cnt2, cnt3, cnt4;
  cin >> cnt1 >> cnt2 >> cnt3 >> cnt4;
  cnt3 = (cnt3 != 0 ? 1 : 0);
  cnt1 -= cnt3;
  cnt4 -= cnt3;
  if (cnt1 >= 0 && cnt4 >= 0 && cnt1 == cnt4) {
    cout << 1;
  } else
    cout << 0;
  return 0;
}
