#include <bits/stdc++.h>
using namespace std;
mt19937 rnd(time(0));
int solve() {
  int x;
  if (!(cin >> x)) return 1;
  int y, z, t;
  cin >> y >> z >> t;
  if (x == t && (!z || x))
    cout << 1;
  else
    cout << 0;
  cout << endl;
  return 0;
}
int32_t main() {
  ios::sync_with_stdio(0);
  int T = 100;
  for (int i = 1; i <= T; i++) {
    if (solve()) break;
  }
  return 0;
}
