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