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