#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1e5 + 5;
int a, b, c, d;
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> a >> b >> c >> d;
  if (a != d) {
    cout << "0\n";
    return 0;
  }
  if (c && !a) {
    cout << "0\n";
    return 0;
  }
  cout << "1\n";
  return 0;
}
