a, b, c, d = map(float, input().split())
aa = 2*d-c
bb = d*d/c
if a - b == b - c == c - d and aa == int(aa):
print(int(aa))
elif a / b == b / c == c / d and bb == int(bb):
print(int(bb))
else:
print(42)
#include <bits/stdc++.h>
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define ll long long
using namespace std;
int main(){
IOS
float a,b,c,d; cin >> a >> b >> c >> d;
if ((b-a)==(c-b) && (c-b)==(d-c))
cout << d+(b-a) << endl;
else if ((b/a)==(c/b) && (c/b)==(d/c)){
float r = d*(b/a);
cout << (r == (int)r ? r : 42) << endl;
}
else cout << 42 << endl;
return 0;
}
1490C - Sum of Cubes | 868A - Bark to Unlock |
873B - Balanced Substring | 1401D - Maximum Distributed Tree |
1716C - Robot in a Hallway | 1688B - Patchouli's Magical Talisman |
99A - Help Far Away Kingdom | 622B - The Time |
1688C - Manipulating History | 1169D - Good Triple |
1675B - Make It Increasing | 588A - Duff and Meat |
1541B - Pleasant Pairs | 1626B - Minor Reduction |
1680A - Minimums and Maximums | 1713A - Traveling Salesman Problem |
1713B - Optimal Reduction | 1710A - Color the Picture |
1686B - Odd Subarrays | 251A - Points on Line |
427C - Checkposts | 1159A - A pile of stones |
508A - Pasha and Pixels | 912A - Tricky Alchemy |
1249A - Yet Another Dividing into Teams | 1713C - Build Permutation |
1699A - The Third Three Number Problem | 1617B - GCD Problem |
841A - Generous Kefa | 1690B - Array Decrements |