#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using pii = pair<int, int>;
const double pi = acos(-1.0);
int main(int argc, char const *argv[]) {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if (a == d && a == 0 && c == 0)
    cout << 1;
  else if (a == d && a != 0)
    cout << 1;
  else
    cout << 0;
  return 0;
}
