Assi and "Washing Powder Nirma"

3.4

24 votes
Easy
Problem

Assi loves to wear clean clothes and his favorite detergent is "Nirma". One day he decided to wash some of his clothes in a triangular basin. While washing his dirty laundry he started wondering : If he had three sticks what would be the largest triangle he can come up with. He might need to chop some of the wood. Largest in the sense that the total sum of the sides must be maximum.

Given the length of three woods return the total length of the sides of the largest possible valid triangle. You may chop one or all woods.

Constraints:

Input

One line which contains three integers A,B and C ( 1<= A,B,C <= 100000 ) .

Output

The maximum total side length .

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

Given sides are not of any valid triangle. So we convert it to a valid triangle with sides :

10 20 29

Total sum of sides = 10 + 20 + 29 = 59

Editor Image

?