Regardless of parentheses, every element is either in the numerator or denominator of the final fraction. The expression A[0] / **(** A[1] / A[2] / ... / A[N-1] **)** has every element in the numerator except A[1], and it is impossible for A[1] to be in the numerator, so it is the largest. We must also be careful with corner cases.

```
def optimalDivision(self, A):
A = map(str, A)
if len(A) <= 2: return '/'.join(A)
return '{}/({})'.format(A[0], '/'.join(A[1:]))
```