#include <bits/stdc++.h>
using namespace std;
void beforeMain() __attribute__((constructor));
void beforeMain() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cout.setf(ios::fixed);
  cout.precision(20);
}
signed main() {
  long long a, b, c, d;
  cin >> a >> b >> c >> d;
  if ((a == d && c == 0) || (a == d && a > 0))
    cout << "1";
  else
    cout << "0";
}
