P23631 [AtCoder] Calculator Game
普及+
题目描述

Problem Description

The calculator you have has two operators: addition (+) and multiplication (×).

You are given three numbers \( A, B, C \). You will input these numbers into the calculator in the order of “\( A \) → \( operator \) → \( B \) → \( operator \) → \( C \)”.

For example, when \( (A, B, C) = (1, 2, 3) \), consider the first operation as addition and the second operation as multiplication. In this case, the input would be “\( 1 \) → \( + \) → \( 2 \) → \( × \) → \( 3 \)”, and the result would be \( 9 \). The calculator performs operations sequentially, so it ignores operator precedence and calculates from left to right.

You decided to play a single-player game where you choose the operations between the numbers to get the maximum value. Determine the maximum value that can be obtained by choosing the operations wisely between the numbers.

Input Format

The input is given from the standard input in the following format:

\( A \) \( B \) \( C \)

  • The first line contains the number \( A \) \( (0 \leq A \leq 9) \).
  • The second line contains the number \( B \) \( (0 \leq B \leq 9) \).
  • The third line contains the number \( C \) \( (0 \leq C \leq 9) \).

Output Format

Output the maximum value of the calculation result in one line. Do not forget the newline at the end.

Sample Input and Output

Sample Input #1

1
2
3

Sample Output #1

9

Sample Input #2

1
0
9

Sample Output #2

10

Sample Input #3

2
3
4

Sample Output #3

24

Sample Input #4

9
9
0

Sample Output #4

81

Notes/Hints

Sample Explanation 1

This is the case mentioned in the problem statement.
- “\( 1 \) → \( + \) → \( 2 \) → \( + \) → \( 3 \)” results in \( 6 \).
- “\( 1 \) → \( + \) → \( 2 \) → \( × \) → \( 3 \)” results in \( 9 \).
- “\( 1 \) → \( × \) → \( 2 \) → \( + \) → \( 3 \)” results in \( 5 \).
- “\( 1 \) → \( × \) → \( 2 \) → \( × \) → \( 3 \)” results in \( 6 \).
Therefore, the maximum value \( 9 \) should be output.

Sample Explanation 2

“\( 1 \) → \( + \) → \( 0 \) → \( + \) → \( 9 \)” results in \( 10 \), which is the maximum value.

Sample Explanation 3

“\( 2 \) → \( × \) → \( 3 \) → \( × \) → \( 4 \)” results in \( 24 \), which is the maximum value.

Sample Explanation 4

“\( 9 \) → \( × \) → \( 9 \) → \( + \) → \( 0 \)” results in \( 81 \), which is the maximum value.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
1 2 3
样例输出
9