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