#include <bits/stdc++.h>
using namespace std;
mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if (a == d && a == 0) {
    if (c > 0)
      cout << 0 << endl;
    else
      cout << 1 << endl;
  } else {
    if (a == d)
      cout << 1 << endl;
    else
      cout << 0 << endl;
  }
  return 0;
}
