#include using namespace std; using LL = long long; int main() { // 1. 入力情報取得. LL b1, b2, b3; scanf("%lld %lld %lld", &b1, &b2, &b3); // 2. 友人が次に言う数字を抽出. // b2 = r * b1 + d // b3 = r * b2 + d // ans = r * b3 + d // -> // b3 - b2 = r * (b2 - b1) // b2 * b2 - b1 * b3 = d * (b2 - b1) // ans * (b2 - b1) = r * b3 * (b2 - b1) + d * (b2 - b1) // = b3 * (b3 - b2) + b2 * b2 - b1 * b3 // となることに注意. LL ans = b3 * (b3 - b2); ans += b2 * b2; ans -= b1 * b3; ans /= (b2 - b1); // 3. 出力. printf("%lld\n", ans); return 0; }