#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, c, d, left, right;
  cin >> a >> b >> c >> d;
  if (a != d && c > 0) {
    cout << 0;
    return 0;
  } else if (a == 0 && d == 0 && c > 0) {
    cout << 0;
    return 0;
  }
  left = (a * 2) + (b * 1) + (c * 1) + (d * 0);
  right = (a * 0) + (b * 1) + (c * 1) + (d * 2);
  if (left == right)
    cout << 1;
  else
    cout << 0;
  return 0;
}
