#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
const int maxn = 1e6;
const long long MAXN = 1e12;
int judge(int a, int b, int c, int d) {
  if (a != d) return 0;
  if (a == 0 && d == 0 && c) return 0;
  return 1;
}
int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << judge(a, b, c, d);
  return 0;
}
