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