#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, e, f, k, m;
  cin >> a >> b >> c >> d;
  if (a != b) {
    e = 1;
  } else {
    e = 0;
  }
  if (a != d) {
    f = 1;
  } else {
    f = 0;
  }
  if ((c + d) >= 1) {
    k = 1;
  } else {
    k = 0;
  }
  if ((b * c) + f >= 1) {
    m = 1;
  } else {
    m = 0;
  }
  int p = e * (k);
  int q = m;
  if (p != q) {
    cout << 1 << endl;
  } else {
    cout << 0 << endl;
  }
  return 0;
}
