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