#include <bits/stdc++.h>
using namespace std;
int arr[200001], socanh[200010], sodinh[200010], up, ngua;
int ar[200001], kq;
int n, m, ans, ans1, k, n1, m1;
int main() {
  int a, b, c, d;
  cin >> a;
  cin >> b;
  cin >> c;
  cin >> d;
  if (a == d) {
    if (c == 0 || a > 0) {
      cout << 1;
      return 0;
    }
  }
  cout << 0;
}
