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