479A.md (1364B)
1 Source: https://codeforces.com/problemset/problem/479/A 2 3 A. Expression 4 5 time limit per test 6 7 1 second 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 stdin 16 17 output 18 19 stdout 20 21 Petya studies in a school and he adores Maths. His class has been studying arithmetic expressions. On the last class the teacher wrote three positive integers *a*, *b*, *c* on the blackboard. The task was to insert signs of operations '+' and '*', and probably brackets between the numbers so that the value of the resulting expression is as large as possible. Let's consider an example: assume that the teacher wrote numbers 1, 2 and 3 on the blackboard. Here are some ways of placing signs and brackets: 22 23 * 1+2*3=7 24 * 1*(2+3)=5 25 * 1*2*3=6 26 * (1+2)*3=9 27 28 Note that you can insert operation signs only between *a* and *b*, and between *b* and *c*, that is, you cannot swap integers. For instance, in the given sample you cannot get expression (1+3)*2. 29 30 It's easy to see that the maximum value that you can obtain is 9. 31 32 Your task is: given *a*, *b* and *c* print the maximum value that you can get. 33 34 Input 35 36 The input contains three integers *a*, *b* and *c*, each on a single line (1 ≤ *a*, *b*, *c* ≤ 10). 37 38 Output 39 40 Print the maximum value of the expression that you can obtain. 41 42 Examples 43 44 Input 45 46 ``` 47 1 48 2 49 3 50 ``` 51 52 Output 53 54 ``` 55 9 56 ``` 57 58 Input 59 60 ``` 61 2 62 10 63 3 64 ``` 65 66 Output 67 68 ``` 69 60 70 ```