#include <bits/stdc++.h>
using namespace std;
int c1, c2, c3, c4;
int main() {
  cin >> c1 >> c2 >> c3 >> c4;
  if (c1 == c4 && c1)
    cout << 1 << endl;
  else if (c1 == c4 && c1 == 0 && c3 == 0)
    cout << 1 << endl;
  else
    cout << 0 << endl;
  return 0;
}
