跳到主要内容
图灵 OJTURING / ONLINE JUDGE

#F2744. Pixels

    ID: 2750 传统题 2000ms 256MiB 尝试: 0 已通过: 0 难度: 7 上传者: 标签>构造数学算法思想提高难度共享题库Codeforces英文题面题目来源题面语言

Pixels

题目描述

B. Pixels
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Flatland is inhabited by pixels of three colors: red, green and blue. We know that if two pixels of different colors meet in a violent fight, only one of them survives the fight (that is, the total number of pixels decreases by one). Besides, if pixels of colors x and y (xy) meet in a violent fight, then the pixel that survives the fight immediately changes its color to z (zx;zy). Pixels of the same color are friends, so they don't fight.

The King of Flatland knows that his land will be peaceful and prosperous when the pixels are of the same color. For each of the three colors you know the number of pixels of this color that inhabit Flatland. Help the king and determine whether fights can bring peace and prosperity to the country and if it is possible, find the minimum number of fights needed to make the land peaceful and prosperous.

Input

The first line contains three space-separated integers a, b and c (0≤a,b,c≤231;a+b+c>0) − the number of red, green and blue pixels, correspondingly.

Output

Print a single number − the minimum number of pixel fights before the country becomes peaceful and prosperous. If making the country peaceful and prosperous is impossible, print -1.

Examples
Input
1 1 1
Output
1
Input
3 1 0
Output
3
Note

In the first test sample the country needs only one fight to achieve peace and prosperity. Besides, it can be any fight whatsoever. For example, let's assume that the green and the blue pixels fight, then the surviving pixel will be red. As a result, after the fight there are two red pixels. There won't be other pixels.

In the second sample the following sequence of fights is possible: red and blue, green and red, red and blue. As a result, after all fights there is one green pixel left.


题目来源:fps-www.educg.net-codeforce-1-2833.xml.zip;FPS 共享题包,题包内第 2411 题。保留原作者与原赛事署名。