#include <bits/stdc++.h>
using namespace std;
int main() {
  double a, b, c, d;
  cin >> a >> b >> c >> d;
  if (b - a == d - c && d - c == c - b) {
    cout << d + b - a;
  } else {
    if (a * c == b * b && b * d == c * c) {
      int t = d * b / a;
      if (t * a == d * b) {
        cout << d * b / a;
      } else {
        cout << 42;
      }
    } else {
      cout << 42;
    }
  }
  return 0;
}
