#include <bits/stdc++.h>
using namespace std;
template <typename T>
void sci(T& t) {
  cin >> t;
}
template <typename T, typename... Ts>
void sci(T& t, Ts&... ts) {
  sci(t);
  sci(ts...);
}
int32_t main() {
  cin.tie(nullptr);
  cout.tie(nullptr);
  ios_base::sync_with_stdio(false);
  int64_t a, b, c, d;
  cin >> a >> b >> c >> d;
  int64_t e = (a ^ b), f = (c | d), g = (b & c), h = (a ^ d);
  int64_t n = (f & e), m = (g | h);
  cout << (n ^ m);
  return 0;
}
