cho.sh
Notes
Loading...

Postfix Expression Evaluation 2

Time limit

2s

Memory limit

128 MB

Problem

You are given a postfix expression and the value corresponding to each operand. Write a program that evaluates the expression.

Input

The first line contains the number of operands N. (1 <= N <= 26)

The second line contains the postfix expression. Operands are uppercase English letters starting from A, using exactly the first N letters in order. The expression length does not exceed 100.

From the third line through the N + 2-th line, one value is given for each operand. The third line is the value of A, the fourth line is the value of B, and so on. Each value is a natural number no greater than 100.

For every given input, while evaluating the postfix expression from left to right, the final result and every intermediate result are between -2,000,000,000 and 2,000,000,000, inclusive.

Output

Print the computed result rounded to exactly two digits after the decimal point.