#include <bits/stdc++.h>
using namespace std;
void read(int &val) {
  int x = 0;
  int bz = 1;
  char c;
  for (c = getchar(); (c < '0' || c > '9') && c != '-'; c = getchar())
    ;
  if (c == '-') {
    bz = -1;
    c = getchar();
  }
  for (; c >= '0' && c <= '9'; c = getchar()) x = x * 10 + c - 48;
  val = x * bz;
}
const int INF = 0x3f3f3f3f;
const int maxn = 1e6 + 100;
const int mod = 998244353;
int n, a[maxn], b[maxn], m;
char s[maxn];
int main() {
  int x, y, z, d;
  read(x);
  read(y);
  read(z);
  read(d);
  if (x != d) {
    puts("0");
    return 0;
  }
  if (z) {
    if ((!x) || (!d)) {
      puts("0");
      return 0;
    }
    if (x && d) {
      puts("1");
      return 0;
    } else {
      puts("0");
      return 0;
    }
  }
  puts("1");
  return 0;
}
