#include <bits/stdc++.h>
using namespace std;
long long ara[12];
int main() {
  long long n, i, j, k;
  for (i = 0; i < 4; i++) {
    cin >> k;
    ara[i] = k;
  }
  if (ara[0] == 0 && ara[3] == 0 && ara[2] > 0) {
    printf("0\n");
  } else {
    if (ara[0] == ara[3])
      printf("1\n");
    else
      printf("0\n");
  }
  return 0;
}
