#include <bits/stdc++.h>
using namespace std;
const int LIM = 1000;
int v[5];
int main() {
  cin >> v[1] >> v[2] >> v[3] >> v[4];
  if (v[1] != v[4] || (v[1] == 0 && v[3] > 0))
    cout << 0;
  else
    cout << 1;
  return 0;
}
