#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  ;
  int cnt1, cnt2, cnt3, cnt4, o = 0, c = 0;
  bool b = true;
  cin >> cnt1 >> cnt2 >> cnt3 >> cnt4;
  if (cnt3 > 0 && (cnt1 == 0 && cnt4 == 0)) b = false;
  if (b && cnt1 == cnt4)
    cout << 1 << endl;
  else
    cout << 0 << endl;
  return 0;
}
