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