# Task

* **_Given_** *three integers* `a` ,`b` ,`c`, **_return_** *the **_largest number_** obtained after inserting the following operators and brackets*: `+`, `*`, `()`
* In other words , **_try every combination of a,b,c with [*+()] , and return the Maximum Obtained_**
___
# Consider an Example :

**_With the numbers are 1, 2 and 3_** , *here are some ways of placing signs and brackets*:

* `1 * (2 + 3) = 5`
* `1 * 2 * 3 = 6`
* `1 + 2 * 3 = 7`
* `(1 + 2) * 3 = 9`

So **_the maximum value_** that you can obtain is  **_9_**.

___
# Notes 

* **_The numbers_** *are always* **_positive_**. 
* **_The numbers_** *are in the range* **_(1  ≤  a, b, c  ≤  10)_**.
* *You can use the same operation* **_more than once_**.
* **It's not necessary** *to place all the signs and brackets*.
* **_Repetition_** *in numbers may occur* .
* You **_cannot swap the operands_**. For instance, in the given example **_you cannot get expression_** `(1 + 3) * 2 = 8`.

___
# Input >> Output Examples:

```
expressionsMatter(1,2,3)  ==>  return 9
```
## **_Explanation_**:
*After placing signs and brackets, the **_Maximum value_** obtained from the expression* `(1+2) * 3 = 9`.
___

```
expressionsMatter(1,1,1)  ==>  return 3
```
## **_Explanation_**:
*After placing signs, the **_Maximum value_** obtained from the expression is* `1 + 1 + 1 = 3`.
___

```
expressionsMatter(9,1,1)  ==>  return 18
```
## **_Explanation_**:
*After placing signs and brackets, the **_Maximum value_** obtained from the expression is* `9 * (1+1) = 18`.
___
___
___

# [Playing with Numbers Series](https://www.codewars.com/collections/playing-with-numbers)

# [Playing With Lists/Arrays Series](https://www.codewars.com/collections/playing-with-lists-slash-arrays)

# [Bizarre Sorting-katas](https://www.codewars.com/collections/bizarre-sorting-katas)

# [For More Enjoyable Katas](http://www.codewars.com/users/MrZizoScream/authored)
___

## ALL translations are welcomed

## Enjoy Learning !!
# Zizou

Difficulty: introductory

Starter code:

def expression_matter(a, b, c):
	

Solutions:
def expression_matter(a, b, c):
    return max(a*b*c, a+b+c, (a+b)*c, a*(b+c))

def expression_matter(a, b, c):
     return max(a + b + c, (a + b) * c, a * (b + c), a * b * c)

def expression_matter(a, b, c):
    cases = [a + b + c]
    cases.append(a * b * c)
    cases.append((a * b) + c)
    cases.append((a + b) * c)
    cases.append(a + (b * c))
    cases.append(a * (b + c))
    return max(cases)

def expression_matter(a, b, c):
  return max(max(eval(f'{a}{op1}({b}{op2}{c})'), eval(f'({a}{op1}{b}){op2}{c}')) for op1 in '+*' for op2 in '+*')

def expression_matter(a, b, c):
    return max(a+b+c, a*b*c, (a+b)*c, a*(c+b))

def expression_matter(a, b, c): return max(a*b*c, a+b+c, a*(b+c), (a+b)*c)

def expression_matter(a, b, c):
    if a == 1: b += 1
    if c == 1: b += 1
    if b == 1:
        if a < c: a += 1
        else: c += 1
    return a * b * c

def expression_matter(a, b, c):
    return max(
        a+b+c,
        a+b*c,
        (a+b)*c,
        a*b+c,
        a*(b+c),
        a*b*c
        )

def expression_matter(a, b, c):
    operations = '+*'
    return max(
        max(eval(f'({a}{op1}{b}){op2}{c}'), eval(f'{a}{op1}({b}{op2}{c})'))
        for op1 in operations
        for op2 in operations
    )

def expression_matter(a, b, c):
    li=[]
    li.append(a*b*c)
    li.append(a+b+c)
    li.append(a+(b*c))
    li.append(a*(b+c))
    li.append((a+b)*c)
    li.append((a*b)+c)
    return max(li)

def expression_matter(a, b, c):
    return max(a+b+c,a*b*c,(a+b)*c,a*(b+c))

def expression_matter(a, b, c):
    if 1 not in [a, b, c]:
        return a * b * c
    elif a == 1 and c == 1:
        return a + b + c
    elif a == 1 or (b == 1 and a < c):
        return (a + b) * c
    else:
        return a * (b + c)

def expression_matter(a, b, c):
    largest_number = 0
    rlt1 = a * (b + c)
    rlt2 = a * b * c
    rlt3 = a + b * c
    rlt4 = (a + b) * c
    rlt5 = a + b + c 
    rlt6 = a * b + c
    list = [rlt1, rlt2, rlt3, rlt4, rlt5, rlt6]
    
    for li in list:
        if li > largest_number:
            largest_number = li
    
    return largest_number

def expression_matter(a, b, c):
    res=[]
    res.append((a+b)+c)
    res.append(a+(b+c))
    res.append((a*b)*c)
    res.append(a*(b*c))
    res.append((a+b)*c)
    res.append(a+(b*c))
    res.append((a*b)+c)
    res.append(a*(b+c))
    return max(res)

def expression_matter(a, b, c):
    d = a + b + c
    e = a * b * c
    f = (a + b) * c
    g = a * (b + c)
    return max(d, e, f, g)

def expression_matter(a, b, c):
    numbers = [a, b, c]

    total = 0
    iCount = 0

    ttl2 = 0
    if 1 in numbers:
        iCount = numbers.count(1)

        for i in numbers:
            if(iCount == 1):
                if(numbers[1] == 1):
                    if(numbers[0] == max(numbers)): ttl2 = 1
                    if(numbers.count(max(numbers)) == 2):
                        ttl2 += i
                    else:
                        if(i != max(numbers)):
                            ttl2 += i
                    total = ttl2 * max(numbers)
                elif(numbers[0] == 1):
                    ttl2 = numbers[0] + numbers[1]
                    total = ttl2 * numbers[2]
                elif(numbers[2] == 1):
                    ttl2 = numbers[2] + numbers[1]
                    total = ttl2 * numbers[0]
            elif(iCount == 2):
                if(numbers[0] == numbers[1] or numbers[1] == numbers[2]):
                    total = max(numbers) * 2
                else:
                    total += i
            elif(iCount == 3):
                total += i
            else:
                if(i == max(numbers)):
                    if(numbers[0] == max(numbers)): total = 1
                    total *= i
                else:
                    total += i
    else:
        total = 1
        for i in numbers:
            total *= i

    return(total)

def expression_matter(a, b, c):
    expressions = [
        a * (b + c),
        a * b * c,
        a + b * c,
        (a + b) * c,
        a + b + c
    ]
    max_value = 0
    for expression in expressions:
        value = expression
        if value > max_value:
            max_value = value
    return max_value

def expression_matter(a, b, c):
    m1 = a*(b+c)
    m2 = a*b*c
    m3 = a+b*c
    m4 = (a+b)*c
    m5 = a+b+c
    large = m1
    if m2 > large:
        large = m2
    if m3 > large:
        large = m3
    if m4 > large:
        large = m4
    if m5 > large:
        large = m5
    return large

def expression_matter(a, b, c):
    val1 = a * b * c
    val2 = (a + b) * c
    val3 = a * (b + c)
    val4 = a + b * c
    val5 = a * b + c
    val6 = a + b + c 
    a = [val1, val2, val3, val4, val5, val6]
    return max(a)

def expression_matter(a, b, c):
    return max(a + b + c, a * (b + c), (a + b) * c, a * b * c)

expression_matter=lambda a, b, c: max(a + b + c, a * (b + c), (a + b) * c, a * b * c)

def expression_matter(a, b, c):
    var1 = a * (b + c)
    var2 = a * b * c
    var3 = a + b * c
    var4 = (a + b) * c
    var5 = a+b+c
    sum = []
    sum.append(var1)
    sum.append(var2)
    sum.append(var3)
    sum.append(var4)
    sum.append(var5)
    
    sum = sorted(sum)
    return sum[-1]

from itertools import starmap, product
from operator import add, mul


def expression_matter(a: int, b: int, c: int):
    return max(starmap(lambda f, g: max(f(a, g(b, c)), g(f(a, b), c)), product((add, mul), repeat=2)))


def expression_matter(a, b, c):
    
    list = []
    list.append(a * b * c)
    list.append(a* (b + c))
    list.append(a + b * c)
    list.append((a + b) * c)
    list.append(a * b + c)
    list.append(a + b + c)
    
    return max(list)

expression_matter(1, 1, 1)

def expression_matter(a, b, c):
    
    ans1 = a * (b + c) 
    ans2 = a * b * c
    ans3 =  a + b * c
    ans4 = (a + b) * c
    ans5 = a + b + c
    
    return max(ans1,ans2,ans3,ans4,ans5)

def expression_matter(a, b, c):
    r = 0
    for o1 in ("+", "*"):
        for o2 in ("+", "*"):
            r = max(r, (max(eval("({} {} {}) {} {}".format(a, o1, b, o2, c)), eval("{} {} ({} {} {})".format(a, o1, b, o2, c)))))
    return r

def expression_matter(a, b, c):
    return max(a*b*c,a*(b+c),a+b+c,(a+b)*c)

def expression_matter(a, b, c):
    return max([(a+b)*c, a*b*c, a+b+c, a+b*c, a*(b+c)])

def expression_matter(a, b, c):
    list_exp = []
    list_exp.append(a*b+c)
    list_exp.append(a+b*c)
    list_exp.append((a+b)*c)
    list_exp.append(a*(b+c))
    list_exp.append(a+b+c)
    list_exp.append(a*b*c)
    list_exp.append(a+b+c)
    return max(list_exp)

def expression_matter(a, b, c):
    s = a + b + c
    m = a * b * c
    n = (a + b) * c
    o = a * (b + c)
    q = a * b + c
    r = a + b * c
    
    return max(s,m,n,o,q,r)

import numpy as np
def expression_matter(a, b, c):
    A = a * b * c 
    B = a * (b + c)
    C = (a * b) + c
    D = a + b + c
    E = a + b * c
    F = (a + b) * c
    R = np.array([A,B,C,D,E,F])
    return R.max()# highest achievable result

def expression_matter(a, b, c):
    n1=a+b+c
    n2=a*b*c
    n3=a*(b+c)
    n4=(a+b)*c
    n5=a+(b*c)
    n6=(a*b)+c
    return max(n1,n2,n3,n4,n5,n6)

def expression_matter(a, b, c):
    lst = []
    lst.append(a * (b + c))
    lst.append(a * b * c)
    lst.append(a + b + c)
    lst.append((a + b) * c)
    return max(lst)


def expression_matter(a, b, c):
    largest = 0
    if a + b + c > largest:
        largest = a + b + c
    if a + b * c > largest:
        largest = a + b * c
    if a * b + c > largest:
        largest = a * b + c
    if a * b * c > largest:
        largest = a * b * c
    if (a + b) * c > largest:
        largest = (a + b) * c
    if a * (b + c) > largest:
        largest = a * (b + c)
    return largest

from itertools import product
from operator import mul, add

def expression_matter(a, b, c):
    if not 1 in [a, b, c]: return a*b*c
    return max(
        max(
            op1(a, op2(b, c)),
            op1(op2(a, b), c)
        )
        for op1, op2 in product([mul, add], repeat=2)
    )

def expression_matter(a, b, c):
    return max(a+b+c, a*b*c, a*(b+c), (a+b)*c)
    #not mine, re-did to make sure I could properly use the max function. 


def expression_matter(a, b, c):
    if a == 1 and b != 1 and c != 1:
        return (a + b) * c
    elif a != 1 and b == 1 and c != 1:
        if (a + b) * c > a * (b + c):
            return (a + b) * c
        else:
            return a * (b + c)
    elif a != 1 and b != 1 and c == 1:
        return a * (b + c)
    elif a == 1 and b == 1 and c == 1:
        return a + b + c
    elif (a == 1 and b == 1 and c != 1):  
        return (a + b) * c
    elif (a == 1 and b != 1 and c == 1):
        return a + b + c
    elif (a != 1 and b == 1 and c == 1):
        return a * (b + c)
    else:
        return a * b * c

def expression_matter(a, b, c):
    var1 = a * (b+c)
    var2 = a * b * c
    var3 = a + b * c
    var4 = (a+b) * c 
    var5 = a + b+ c
    result = sorted([var1,var2,var3,var4,var5])[-1]
    return result 

def expression_matter(a, b, c):
    calc = [
        a * b + c,
        a + b * c,
        (a + b) * c,
        a * (b + c),
        a * b * c,
        a + b + c
    ]
    return max(calc)

def expression_matter(a, b, c):
    calc = [
        a * (b + c),
        a * b * c,
        a + b * c,
        (a + b) * c,
        a + b + c
    ]
    return max(calc)

def expression_matter(a, b, c):
    return max(a*(c+b), a*b*c, a+b+c, a+b*c, (a+b)*c)

def expression_matter(a, b, c):
    result = 0
    result = max(result, a*(b+c))
    result = max(result, a*b*c)
    result = max(result, a+b*c)
    result = max(result, (a+b)*c)
    result = max(result, a+b+c)
    return result


def expression_matter(a, b, c):
    result = 0
    if a + b + c > result: result = a + b + c
    if a + b * c > result: result = a + b * c
    if a * b + c > result: result = a * b + c
    if a * b * c > result: result = a * b * c
    if (a + b) * c > result: result = (a + b) * c
    if a * (b + c) > result: result = a * (b + c)
    return result

def expression_matter(a, b, c):
    x = a + b + c
    y = (a + b) * c
    z = a * (b + c)
    w = a * b * c
    
    lis = [x, y, z, w]
    ans = max(lis)
    return ans # highest achievable result

def expression_matter(a, b, c):
    arr = []
    arr.append(a*b*c)
    arr.append(a+b+c)
    arr.append(a*b+c)    
    arr.append(a*(b+c))
    arr.append((a+b)*c)
    
    print(arr)
    return (max(arr))

# Two possible resolutions: using ifs to decide which one will be the largest or max between all possibilities

# def expression_matter(a, b, c):
#     if a == 1 and c == 1:
#         return a + b + c
#     if a == 1:
#         return (a + b) * c 
#     if c == 1:
#         return a * (b + c)
#     if b == 1:
#         return max(a * (b + c), (a + b) * c)
#     return a * b * c

def expression_matter(a, b, c):
    return max([a + b + c, (a + b) * c, a * (b + c), a * b * c])

def expression_matter(a, b, c):
    d = a * (b + c)
    e = a * b * c
    f = a + b * c
    g = (a + b) * c
    h = a + b + c

    if (e >= d and e >= h) and (e >= f and e >= g):
        return e
    elif (d >= e and d >= h) and (d >= f and d >= g):
        return d
    elif (f >= d and f >= h) and (f >= e and f >= g):
        return f
    elif (g >= d and g >= h) and (g >= e and g >= f):
        return g
    elif (h >= d and h >= g) and (h >= e and h >= f):
        return h

def expression_matter(a, b, c):     
    return max(
        a * (b + c), 
        (a * b) + c, 
        a * b * c, 
        a + b * c, 
        (a + b) * c,
        a + b + c
    )

def expression_matter(a, b, c):
    a=[(a*(b+c)),(a*b*c),((a+b)*c),(a+b+c)]
    return max(a)

def expression_matter(a, b, c):
    x = []
    x.append(a * (b + c))
    x.append(a * b * c)
    x.append(a + b * c)
    x.append((a + b) * c)
    x.append(a + b + c)
    return max(x)

def expression_matter(a, b, c):
    no_1 = a * (b + c)
    no_2 = a + b + c
    no_3 = a * b * c
    no_4 = (a + b) * c
    if no_3 > no_1 and no_3 > no_2 and no_3 > no_4:
        return no_3
    if no_4 > no_1 and no_4 > no_2:
        return no_4
    if no_2 > no_1:
        return no_2
    else:
        return no_1

def expression_matter(a, b, c):
    
    
    h = a*b+c
    d = a*(b+c)
    e = a+b*c
    f = (a+b)*c
    g = a*b*c
    i = a+b+c
    list = [h,d,e,f,g,i]
    return max(list)

def expression_matter(a, b, c):
    if (a*(b+c) >= (a+b)*c) and (a*(b+c) >= a+b+c) and (a*(b+c) >= a*b*c) :
        return a*(b+c)
    if ((a+b)*c  >= a*(b+c)) and ((a+b)*c) >= (a+b+c) and ((a+b)*c) >= (a*b*c) :
        return (a+b)*c 
    if  ( a*b*c >= (a+b)*c) and (a*b*c  >= a+b+c) and (a*b*c >= a*(b+c)) :
        return a*b*c
    else :
        return a+b+c
   



from functools import reduce

expression_matter = lambda a, b, c: reduce( lambda accum, next: accum * next if accum*next > accum+next else accum + next, [a, b, c] if c > a else [c, b, a])

from functools import reduce

def expression_matter(a, b, c):
    return reduce(lambda accum, next : accum * next if accum*next > accum+next else accum + next, [c, b, a] if c < a else [a, b ,c])


def expression_matter(a, b, c):
    mass = [a,b,c]
    return max([(mass[0]+mass[1])*mass[2],(mass[0]+mass[1])+mass[2],mass[0]*(mass[1]+mass[2]),(mass[0]*mass[1])*mass[2]])

expression_matter = lambda *a: [a[0]*a[1]*a[2],[(1+a[1])*a[2-2*(a[0]!=1)],(1+sorted(a)[1])*max(a)][a[1]==1],[sum(a),2*max(a)][a[1]==1],3][a.count(1)]

def expression_matter(a, b, c):
    f=a*(b+c)
    d=a*b*c
    s=a+b*c
    v=(a+b)*c
    return max(f,d,s,v,a+b+c)


def expression_matter(a, b, c):
    sample1 = a + b + c
    sample2 = a * b * c
    sample3 = (a + b) * c
    sample4 = a * (b + c)
    return max(sample1, sample2, sample3, sample4)

def expression_matter(a, b, c):

    result_1 = (a + b) * c
    result_2 = a * (b + c)
    result_3 = (a + b) * c
    result_4 = a * b * c
    result_5 = a + b + c


    if result_1 >= result_2 and result_1 >= result_3 and result_1 >= result_4 and result_1 >= result_5:
        return result_1
    elif result_2 >= result_1 and result_2 >= result_3 and result_2 >= result_4 and result_2 >= result_5:
        return result_2
    elif result_3 >= result_1 and result_3 >= result_2 and result_3 >= result_4 and result_3 >= result_5:
        return result_3
    elif result_4 >= result_1 and result_4 >= result_2 and result_4 >= result_3 and result_4 >= result_5:
        return result_4
    elif result_5 >= result_1 and result_5 >= result_2 and result_5 >= result_3 and result_5 >= result_4:
        return result_5

def expression_matter(a, b, c):
    return max(list(map(eval, gen(a, b, c))))

def gen(a, b, c):
    ops = ['+', '*']
    combs = []
    for i in ops:
        for j in ops:
            s = '%d %s %d %s %d' % (a, i, b, j, c)
            t = '(%d %s %d) %s %d' % (a, i, b, j, c)
            u = '%d %s (%d %s %d)' % (a, i, b, j, c)
            combs.append(s)
            combs.append(t)
            combs.append(u)
    return combs


def expression_matter(a, b, c):
    result = a * (b + c)
    
    new = a * b * c
    
    if new >result:
        result = new
    new = a + b * c
        
    if new >result:
        result = new
        
    new = (a + b) * c
        
    if new >result:
        result = new
    
    new = a + b + c
        
    if new >result:
        result = new
        
    return result

def expression_matter(a, b, c):
    x = [a,b,c]
    results = []
    
    results.append (a*b*c)
    results.append(a*(b+c))
    results.append((a+b)*c)
    results.append(a+b+c)
    
    return max(results)
    


def expression_matter(a, b, c):
    lt = [a*(b+c), (a+b)*c, a*b*c, a+b*c, a*b+c, a+b+c]
    return max(lt)

def expression_matter(a, b, c):
    all = [a+b+c, a+b*c, a*b+c, a*b*c, (a+b)*c, a*(b+c)]
    return max(all)
        


def expression_matter(a, b, c):
    result1 = a * (b+c)
    result2 = a * b * c
    result3 = a + b * c
    result4 = (a + b) * c
    result5 = a + b + c
    
    return max(result1,result2,result3,result4,result5)

def expression_matter(a, b, c):
    return max([(a+b+c),
                (a+b) * c,
                (b+c) * a,
                (a*b*c)
    ])

def expression_matter(a, b, c):
    max=0
    if max<a+b+c:
        max=a+b+c
    if max<a+b*c:
        max=a+b*c
    if max<a*b*c:
        max=a*b*c
    if max<a*b+c:
        max=a*b+c
    if max<a+(b*c):
        max=a+(b*c)
    if max<(a+b)*c:
        max=(a+b)*c
    if max<a*(b+c):
        max=a*(b+c)
    if max<(a*b)+c:
        max=(a*b)+c
    return max

def expression_matter(a, b, c):
    s = []
    s.append(a*b*c)
    s.append(a+b+c)
    s.append(a+b*c)
    s.append((a+b)*c)
    s.append(a*b+c)
    s.append(a*(b+c))
    return max(s)

def expression_matter(a, b, c):
    return max(a+b+c, a+b*c, a*b+c, a*b*c, (a+b)*c, a+(b*c), a*(b+c))

def expression_matter(a, b, c):
    l = [a+b+c, a+b*c, a*b+c, a*b*c, (a+b)*c, a+(b*c), a*(b+c)]
    return max(l)

def expression_matter(a, b, c):
    res = []
    res.append(a + b + c)
    res.append(a * b * c)
    res.append(a + b * c)
    res.append(a * b + c)
    res.append((a + b) * c)
    res.append(a * (b + c))
    return max(res)

def expression_matter(a, b, c):
    if a == 1 and b != 1 and c != 1:
        return (a + b) * c
    if a != 1 and b == 1 and c != 1 and (a > c or a == c):
        return a * (b + c)
    if a != 1 and b == 1 and c != 1 and a < c:
        return (a + b) * c
    if a != 1 and b != 1 and c == 1:
        return a * (b + c)
    if a > 1 and b > 1 and c > 1:
        return a * b * c
    if a > 1 and b == 1 and c == 1:
        return a * (b + c)
    if a == 1 and b == 1 and c > 1:
        return (a + b) * c
    else:
        return a + b + c
    


def expression_matter(a, b, c):
    return max(a + b + c, a * b + c, a * b * c, a * (b + c), (a * b) + c, (a + b) * c)

def expression_matter(a, b, c):
    res_1 = a + b + c
    res_2 = a * b * c
    res_3 = a + b * c
    res_4 = a * b + c
    res_5 = (a + b) * c
    res_6 = a * (b + c)
    return max(res_1, res_2, res_3, res_4, res_5, res_6)


def expression_matter(a, b, c):
    value_1 = a+b+c
    value_2 = a*b*c
    value_3 = a*(b+c)
    value_4 = (a+b)*c
    value_5 = a*b+c
    value_6 = a+b*c
    empty_list = []
    empty_list.append(value_1)
    empty_list.append(value_2)
    empty_list.append(value_3)
    empty_list.append(value_4)
    empty_list.append(value_5)
    empty_list.append(value_6)
    return max(empty_list)

def expression_matter(a, b, c):
    answer_1 = a * (b + c)
    answer_2 = a * b * c
    answer_3 = a + b * c
    answer_4 = (a + b) * c
    answer_5 = a + b + c
    return max(answer_1, answer_2, answer_3, answer_4, answer_5)

def expression_matter(a, b, c):
    op1 = (a + b) * c
    op2 = (a * b) * c
    op3 = (a * b * c)
    op4 = a * (b + c)
    op5 = (a + b + c)
    return max(op1, op2, op3, op4, op5)

def expression_matter(a, b, c):
    x = a * (b + c)
    y = a * b * c
    z = a + b * c
    i = (a + b) * c
    m = a + b + c
    
    arr = [x, y, z, i, m]
    arr.sort()
    return max(arr)

def expression_matter(a, b, c):
    return max(
        max(
            eval('{0} {1} ( {2} {3} {4} )'.format(a, op1, b, op2, c)),
            eval('( {0} {1} {2} ) {3} {4}'.format(a, op1, b, op2, c))
        ) for op1 in '+*' for op2 in '+*'
    )

def expression_matter(a, b, c):
    print(a,b,c)
    arr = []
    d = a*b*c
    arr.append(d)
    e = (a+b)*c
    arr.append(e)
    f = a*(b+c)
    arr.append(f)
    g = a+b*c
    arr.append(g)
    h = a*b+c
    arr.append(h)
    i = a+b+c
    arr.append(i)
    
    
    return max(arr)

def expression_matter(a, b, c):
    return max((a + b) * c, a + b + c, a * b * c, a * (b + c), a + b * c, a * b + c)

def expression_matter(a, b, c):
    x=(a+b)*c
    w=a+b+c
    y=a*(b+c)
    z=a*b*c
    return max(x,w,y,z)

def expression_matter(a, b, c):
    abc1 = a * (b+c)
    abc2 = a*b*c
    abc3 = a+b*c
    abc4 = (a+b) * c
    abc5 = a + b +c
    return max(abc1,abc2,abc3,abc4, abc5)


def expression_matter(a, b, c):
    arr = []
    arr.append(a + b + c)
    arr.append(a + b * c)
    arr.append(a * b + c)
    arr.append(a * (b + c))
    arr.append((a + b) * c)
    arr.append(a * b * c)
    return max(arr)

import statistics
def expression_matter(a, b, c):
    lis = []
    lis.append(a * b * c)
    lis.append((a + b) * c)
    lis.append(a + (b * c))
    lis.append(a + b + c)
    lis.append((a * b) + c)
    lis.append(a * (b + c))
    return max(lis)

def expression_matter(a, b, c):
    x1 = a+b+c
    x2 = (a+b)*c
    x3 = a*(b+c)
    x4 = a*b*c
    nums = []
    nums.append(x1)
    nums.append(x2)
    nums.append(x3)
    nums.append(x4)
    return max(nums)

def expression_matter(a, b, c):
    tmp=([a,b,c])
    return max(\
               tmp[0]+tmp[1]+tmp[2], \
               tmp[0]*tmp[1]*tmp[2], \
               tmp[0]+tmp[1]*tmp[2], \
               tmp[0]*tmp[1]+tmp[2], \
               (tmp[0]+tmp[1])*tmp[2], \
               tmp[0]+(tmp[1]*tmp[2]), \
               (tmp[0]*tmp[1])+tmp[2], \
               tmp[0]*(tmp[1]+tmp[2]), \
              )

def expression_matter(a, b, c):
    rez1 = a*(b+c)
    rez2 = a*b*c
    rez3 = a+b*c
    rez4 = (a+b)*c
    rez5 = a+b+c
    return max(rez1, rez2, rez3, rez4, rez5)
    



def expression_matter(a, b, c):
    a1 = (a + b) * c
    a2 = a * b * c
    a3 = a * (b + c)
    a4 = a + b * c
    a5 = a + b + c
    return max(a1, a2, a3, a4, a5)

def expression_matter(a, b, c):
    x = [a + b + c,  a * b * c, (a + b) * c, a * (b + c)]
    return max(x)

def expression_matter(a, b, c):
    if a <= 0 or b<= 0 or c <= 0:
        return ("Error. Value of a, b, c should be greater than zero")
    else:
        n1 = a * (b + c) 
        n2 = a * b * c
        n3 = a + b * c
        n4 = (a + b) * c
        n5 = a + b + c
        n6 = a * b + c
    return(max(n1, n2, n3, n4, n5, n6))

def expression_matter(a, b, c):
    res = max(a*(b+c),a*b*c,a+b*c,(a+b)*c,a+b+c)
    return res

a = 2
b = 1
c = 2
print(expression_matter(a,b,c))

def expression_matter(a, b, c):
    l=[]
    o=a*(b+c)
    l.append(o)
    t=a*b*c
    l.append(t)
    th=a+b+c
    l.append(th)
    f=(a+b)*c
    l.append(f)
    return max(l)

def expression_matter(a, b, c):
    maxValue = a * b * c
    if a * (b+c) > maxValue:
        maxValue = a * (b+c)
    if a + b + c > maxValue:
        maxValue = a + b + c
    if a + b * c > maxValue:
        maxValue = a + b * c
    if (a+b) * c > maxValue:
        maxValue = (a+b) * c
    return maxValue

def expression_matter(a, b, c):
    v1 = a+b+c
    v2 = (a+b)*c
    v3 = a*(b+c)
    v4 = a*b*c
    return max(v1,v2,v3,v4)


def expression_matter(a,
                      b,
                      c):

    potential = [a + b + c,
                 a + b * c,
                 (a + b) * c,
                 a * b + c,
                 a * (b + c),
                 a * b * c,
                 a * c + b,
                 a * (c + b)]

    return max(potential)


def expression_matter(a, b, c):
    e1 = a*b*c
    e2 = a+b+c
    e3 = (a+b)*c
    e4 = a*(b+c)
    
    list=[]
    list.append(e1)
    list.append(e2)
    list.append(e3)
    list.append(e4)
    
    return max(list)

def expression_matter(a, b, c):
    h1 = a + b + c
    h2 = a * b * c
    h3 = a + b * c
    h4 = a * b + c
    h5 = (a + b) * c
    h6 = a + (b * c)
    h7 = a * (b + c)
    return max(h1,h2,h3,h4,h5,h6,h7)

def expression_matter(a, b, c):
    print(a, b, c)
    x = (a + b) * c
    y = a * (b + c)
    z = a + b + c
    w = a * b * c
    v = a + b * c
    v1 = a * b + c
    #print(x, y, z, w, v, v1)
    return max(x, y, z, w, v, v1)