#include <bits/stdc++.h>
using namespace std;
int main() {
  long cnt1, cnt2, cnt3, cnt4;
  cin >> cnt1 >> cnt2 >> cnt3 >> cnt4;
  if (cnt1 == cnt4 and (cnt3 == 0 or cnt1 > 0))
    printf("1");
  else
    printf("0");
}
