#include <bits/stdc++.h>
using namespace std;
long long int arr[300005];
long long int brr[105][105];
long long int marked[100005];
long long int value[100005];
vector<long long int> prime;
long long int correct = 0;
map<long long int, long long int> mm;
long long int n;
map<long long int, long long int>::iterator it;
int main() {
  ios_base::sync_with_stdio(false);
  long long int i, w1, h1, w2, h2, change = 0, ans = 0, j, k = 0, lb1, ub1,
                                   m = 0, a, b, c, d, lb, ub, mid, min1 = 0,
                                   min2 = 0, w, h, l;
  cin >> i >> j >> k >> l;
  if (i != l) {
    cout << "0" << endl;
    return 0;
  }
  if (i == 0 && k != 0) {
    cout << "0" << endl;
    return 0;
  }
  cout << "1" << endl;
  return 0;
}
