#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
const int MAX = 2e9 + 7;
const long long MOD = 1e9 + 7;
void solve(int qq) {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if (a == d) {
    if (a == 0 and c > 0)
      cout << 0 << endl;
    else
      cout << 1 << endl;
  } else
    cout << 0 << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  t = 1;
  for (int i = 1; i <= t; i++) {
    solve(i);
  }
  return 0;
}
