With a bunch of toothpicks it is possible to write down simple mathematical expressions. Positive integers are formed by putting the same amount of toothpicks vertically next to each other (|). For example, the number three is written as |||. We can also put two toothpicks together to build a plus sign (+), and if we tilt those over 45 degrees we get the multiplication operator (x). Putting all of that together, the expression || x |||| + | is another way to express the number nine using eleven toothpicks in total.
Python has a built-in function eval1 that takes a string argument. The function evaluates the string as a Python expression, and returns the object that results after evaluation of the expression.
>>> eval('1 + 1')
2
>>> eval('2 * 4 + 1')
9
>>> eval('2 + 3 * 7 ** 4')
7205
A mathematical expression, put together using a number of toothpicks. In writing down this expression in string representation, only the following characters are used: |, + and x (lower case letter). In addition, the string representation may contain spaces at any position before, after and in between these characters. Spaces are only used to make the string representation more readable, but do not alter the meaning of the expression.
Write out a line that contains a message formatted according to the template
expression = n (m toothpicks)
Snippets of the template that are in italic font have to be filled up based on given and computed information. The placeholder expression must be filled by the string representation of the expression, as read from the input. The expression, however, must be formatted according to the following style rules
there is no white space at the start and end of the expression
there is no white space in between subsequent vertical lines (|)
there is exactly one space before and after each operator (+, x)
The value n represents the decimal value of the expression, and the value m represents the number of toothpicks needed to put the expression together using toothpicks. Do not forget to take into account the toothpicks that are needed to form the mathematical operators in the expression!
Input:
| | x|| | |+|
Output:
|| x |||| + | = 9 (11 toothpicks)