#include <bits/stdc++.h>
using namespace std;
int main() {
  int cnt1, cnt2, cnt3, cnt4;
  cin >> cnt1 >> cnt2 >> cnt3 >> cnt4;
  long long left = 2 * cnt1 + cnt2 + cnt3, right = 2 * cnt4 + cnt2 + cnt3;
  if (cnt1 == cnt4 && (!cnt1 && !cnt3 || cnt1))
    cout << 1;
  else
    cout << 0;
}
