#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int N = 1e5 + 5;
int gcd(int a, int b) {
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
int n, c;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int a1, a2, a3, a4;
  cin >> a1 >> a2 >> a3 >> a4;
  if (a1 != a4) {
    cout << 0;
    return 0;
  }
  if (a3 != 0 && (a1 == 0 || a4 == 0)) {
    cout << 0;
    return 0;
  }
  cout << 1;
}
