Write a program that calculates the value of an arithmetic expression written as a character string. The expression uses integers, arithmetic operators, parentheses, function calls ( sin
, cos
, abs code> , sqrt
) and variable names (single-letter only). The result of the division operation – real number.
Input
The first line contains the correct entry for the arithmetic expression. The next few lines contain the values of all the variables used in the expression. Each of these lines has the format:
<variable name>=<value>
Each variable name consists of one lowercase Latin letter.
Output
The program must output the value of the expression passed to it as a real number. When displaying the result, you need to leave 3 digits in the fractional part of the number.
Examples
# |
Input |
Output |
1 |
cos(z+abs(sqrt(r*sin(x+4))))
r=5
z=10
x=3
|
0.729
|