#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d;
  scanf("%d%d%d%d", &a, &b, &c, &d);
  if (a != d) return !printf("0\n");
  if (c && !a) return !printf("0\n");
  printf("1\n");
  return 0;
}
