#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long MAX = 2 * 1e18;
void solve() {
  long long a, b, c, d;
  cin >> a >> b >> c >> d;
  if (a != d)
    cout << 0;
  else {
    if (a)
      cout << 1;
    else if (!a && !c)
      cout << 1;
    else
      cout << 0;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
