#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[4];
  for (int i = 0; i < 4; i++) {
    cin >> a[i];
  }
  if (a[0] == 0 && a[2] == 0 && a[3] == 0) {
    cout << 1;
    return 0;
  }
  if (a[0] == a[3] && a[0] != 0) {
    cout << 1;
    return 0;
  }
  cout << 0;
  return 0;
}
