Suppose we have a sequence of $n$ numbers and $n-1$ operators (+ or -), where the order of the numbers and the operators are fixed. For example 5-2-1+3. By different parentheses, you get different values. For example (5 - 2)-1+3 = 5, 5-(2-1)+3=7, (5 - 2)-(1+3) = -1, and so on. For example, the maximum of the sequence $4+3-2$ is $4+(3-2) = 5$.
I am interested in the maximum that such a sequence can have with proper parentheses. But I don't see any pattern and method how this can be determined efficiently ?