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