Under construction

Still being built. Things may change

Three Sticks

Interview

Time limit2sMemory limit512 MB

Summary
Given three stick lengths, shorten them to positive integers so they form a non-degenerate triangle with the largest possible perimeter.
Level

Easy3 of 10

Topics
Greedy, Math, Implementation, Sorting
Solved
No attempts yet

Problem

Yeongseon has three sticks of lengths aa, bb, and cc, and she can shorten each stick to any length she likes.

She wants to build a triangle out of the three sticks so that all of the following hold.

  • The length of each stick is a positive integer.
  • The three sticks form a triangle of positive area.
  • The perimeter of the triangle is as large as possible.

Given aa, bb, and cc, write a program that finds the largest perimeter she can build.

Input

The first line contains three integers aa, bb, cc. (1≤a,b,c≤1001 \le a, b, c \le 100)

Output

Print the largest perimeter of a triangle that can be built.

Examples4

  1. Example 1

    Input
    1 2 3
    
    Expected output
    5
    
  2. Example 2

    Input
    2 2 2
    
    Expected output
    6
    
  3. Example 3

    Input
    1 100 1
    
    Expected output
    3
    
  4. Example 4

    Input
    41 64 16
    
    Expected output
    113