OVFL - Overestimate

no tags 

Mr. M and Mr. O are discussing putting a problem. They found that the effort to write a problem is a × b + c for some a, b and c. Since Mr. O is evil, he wants to maximize the effort that Mr. M will do writing the problems.

Help Mr. O to do this.

Input

Given a, b and c (0 ≤ a, b, c ≤ 1,000,000) Find an ordering for them such that a × b + c is maximum.

Output

The maximum effort Mr. M can do.

Example

Input:
2 3 4

Output:
14

Explanation of Example

There are 6 different ways to order the numbers:

  • 2 × 3 + 4
  • 2 × 4 + 3
  • 3 × 2 + 4
  • 3 × 4 + 2
  • 4 × 2 + 3
  • 4 × 3 + 2

But the max value we can reach is 14 which can be achieved by 3 × 4 + 2


hide comments
Ahmed Alaa: 2012-03-06 09:12:56

is the input only three numbers for any test case ?


Added by:Omar ElAzazy
Date:2011-12-13
Time limit:0.709s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:Own Problem