#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
template <typename T, typename T1>
T mod(T x, T1 p) {
  x %= p;
  if (x < 0) x += p;
  return x;
}
template <typename T>
T inverse(T x, T p) {
  x = mod(x, p);
  if (x == 1) return x;
  return mod(1LL * (-p / x) * (inverse(p % x, p)), p);
}
template <typename F, typename S>
ostream &operator<<(ostream &os, const pair<F, S> &p) {
  return os << "(" << p.first << ", " << p.second << ")";
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  typename vector<T>::const_iterator it;
  for (it = v.begin(); it != v.end(); it++) {
    if (it != v.begin()) os << ", ";
    os << *it;
  }
  return os << "}";
}
template <typename T>
ostream &operator<<(ostream &os, const set<T> &v) {
  os << "[";
  typename set<T>::const_iterator it;
  for (it = v.begin(); it != v.end(); it++) {
    if (it != v.begin()) os << ", ";
    os << *it;
  }
  return os << "]";
}
template <typename F, typename S>
ostream &operator<<(ostream &os, const map<F, S> &v) {
  os << "[";
  typename map<F, S>::const_iterator it;
  for (it = v.begin(); it != v.end(); it++) {
    if (it != v.begin()) os << ", ";
    os << it->first << " = " << it->second;
  }
  return os << "]";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long a, b, c, d;
  cin >> a >> b >> c >> d;
  if (a != d || (c > 0 && a == 0 && d == 0)) {
    cout << 0;
    return 0;
  }
  cout << 1;
  return 0;
}
