PivotOJ

CETIRI

시간 제한: 1000ms메모리 제한: 128MB출처: COCI 2007-2008BOJ 2997

문제

Mirko has chosen four integers which form an arithmetic progression. In other words, when the four numbers are sorted, then the difference between each pair of adjacent elements is constant. 

As has become usual, Mirko lost one of the numbers and also is not sure whether the remaining three are in the correct (sorted) order. 

Write a program that, given the three remaining numbers, finds the fourth number.

입력

The input contains 3 integers between −100 and 100 on a single line, separated by single spaces. 

Note: the input data will guarantee that a solution, although not necessarily unique, will always exist.

출력

Output any number which could have been the fourth number in the sequence. 

 

예제

예제 1

입력
4 6 8
출력
10

예제 2

입력
10 1 4
출력
7
코드를 제출하려면 로그인하세요.