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