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