#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int c1, c2, c3, c4;
  cin >> c1 >> c2 >> c3 >> c4;
  if (c1 != c4) {
    cout << 0;
  } else if (c1 < 1 && c3 > 0) {
    cout << 0;
  } else {
    cout << 1;
  }
  return 0;
}
