#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long a, b, c, d;
  cin >> a >> b >> c >> d;
  if (c >= 1 && a >= 1 && d >= 1) {
    a--;
    d--;
    if (a == d)
      cout << 1;
    else
      cout << 0;
  } else if (c >= 1)
    cout << 0;
  else if (c == 0 && a == d)
    cout << 1;
  else
    cout << 0;
  return 0;
}
