#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int Maxn = 1e5 + 10;
int a[5];
int main() {
  for (int i = 1; i <= 4; i++) {
    cin >> a[i];
  }
  if (a[1] != a[4]) {
    cout << 0 << endl;
    return 0;
  }
  if (a[1] == a[4]) {
    if (a[3] && a[1] == 0)
      cout << 0 << endl;
    else
      cout << 1 << endl;
  }
}
