#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 123;
const int inf = 1e9 + 1;
int a, b, c, d;
int main() {
  cin >> a >> b >> c >> d;
  if (a == d && d == 0 && c > 0) {
    cout << 0;
  } else {
    cout << (a == d);
  }
  return 0;
}
