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