#include <bits/stdc++.h>
using namespace std;
bool compare(long long int a, long long int b) { return a > b; }
void solve() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if (a != d) {
    cout << 0;
    return;
  }
  if (c != 0 && a == 0) {
    cout << 0;
    return;
  }
  cout << 1;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
