COCI 2007/2008, Contest #3

Task CETIRI

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.

Input

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

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

Examples

Input

4 6 8

Output

10

Input

10 1 4

Output

7

All Submissions
Best Solutions


Point Value: 3
Time Limit: 1.00s
Memory Limit: 32M
Added: Jul 30, 2013

Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

Comments (Search)

It's quiet in here...