#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
int dx[] = {1, -1, 0, 0, -1, 1, -1, 1};
int dy[] = {0, 0, 1, -1, -1, -1, 1, 1};
void file() {}
int main() {
  cout << setprecision(20) << fixed;
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  file();
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  long long ans = b;
  if ((!a && c) || a != d)
    cout << 0 << "\n";
  else
    cout << 1 << "\n";
}
