#include <bits/stdc++.h>
using namespace std;
int c[5];
int main() {
  for (int i = 1; i <= 4; i++) cin >> c[i];
  if (c[1] == c[4] && c[1] == 0 && c[3] > 0)
    cout << 0 << "\n";
  else if (c[1] == c[4])
    cout << 1 << "\n";
  else
    cout << "0\n";
  return 0;
}
