#include <bits/stdc++.h>
using namespace std;
const int MAX = 2e5 + 9;
int main() {
  int t = 1;
  while (t--) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if ((a > 0 && d > 0 && a == d && c >= 0) || (a == 0 && d == 0 && c == 0))
      cout << "1\n";
    else
      cout << "0\n";
  }
}
