#include <bits/stdc++.h>
using namespace std;
int main() {
  int ct1, ct2, ct3, ct4;
  cin >> ct1 >> ct2 >> ct3 >> ct4;
  if (ct1 == ct4) {
    if (ct3 && ct1 == 0) {
      cout << 0;
    } else {
      cout << 1;
    }
  } else {
    cout << 0;
  }
}
