#include <bits/stdc++.h>
using namespace std;
int main() {
  int in[8];
  bool valid = false;
  for (int z = 0; z < 4; z++) scanf("%d", &in[z]);
  if (in[0] - in[3] == 0) {
    if (in[2] != 0) {
      if (in[0] != 0) valid = true;
    } else
      valid = true;
  }
  if (valid)
    printf("1\n");
  else
    printf("0\n");
  return 0;
}
