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