#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n1, n2, n3, n4, right = 0, left = 0, x;
  cin >> n1 >> n2 >> n3 >> n4;
  if ((n1 == n4) && (n3 == 0 || n1 > 0))
    cout << 1;
  else
    cout << 0;
}
