Time limit
2s
Memory limit
128 MB
You are given an expression made only of numbers and the symbols + and -. Insert parentheses into the expression so that its evaluated value is as small as possible.
Write a program that prints the minimum value that can be obtained.
The first line contains the expression. It consists only of digits (0 through 9), +, and -, and its first and last characters are digits.
No two operators appear consecutively, and each number has at most 5 digits. A number may start with 0. The length of the expression is at most 50.
Print the minimum possible value of the expression on the first line.