#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long MOD = 10092272478850909;
const int MAXN = 100005;
const int MAXM = 100000 + 10;
const double PI = acos(-1);
const double eps = 1e-8;
int main() {
  int cnt1, cnt2, cnt3, cnt4;
  cin >> cnt1 >> cnt2 >> cnt3 >> cnt4;
  if (cnt1 == cnt4) {
    if (cnt1 == 0) {
      if (cnt3 != 0) {
        cout << "0\n";
      } else
        cout << "1\n";
    } else {
      cout << "1\n";
    }
  } else
    cout << "0\n";
}
