#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b, c, d;
  cin >> a;
  cin >> b;
  cin >> c;
  cin >> d;
  if (a == d) {
    if (a == 0 && c > 0) {
      cout << 0 << endl;
    } else {
      cout << 1 << endl;
    }
  } else {
    cout << 0 << endl;
  }
  return 0;
}
