#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int inf = 1e9 + 5;
long long powmod(long long a, long long b) {
  long long ret = 1;
  while (b) {
    if (b & 1) ret = (ret * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return ret;
}
const int maxn = 1e5 + 5;
int c1, c2, c3, c4;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> c1 >> c2 >> c3 >> c4;
  if (c1 == c4 && c1 > 0)
    cout << "1\n";
  else if (c3 == 0 && c1 == c4)
    cout << "1\n";
  else
    cout << "0\n";
  return 0;
}
