import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
String s = br.readLine();
Map<Character, Double> map = new HashMap<>();
Stack<Double> stack = new Stack<>();
char c = 'A';
for(int i=0; i<n; i++) {
map.put(c, Double.parseDouble(br.readLine()));
c = (char)(c+1);
}
for(int i=0; i<s.length(); i++) {
if(s.charAt(i)=='+') {
double n1 = stack.pop();
double n2 = stack.pop();
stack.push(n1+n2);
} else if(s.charAt(i)=='-') {
double n1 = stack.pop();
double n2 = stack.pop();
stack.push(n2-n1);
} else if(s.charAt(i)=='*') {
double n1 = stack.pop();
double n2 = stack.pop();
stack.push(n1*n2);
} else if(s.charAt(i)=='/') {
double n1 = stack.pop();
double n2 = stack.pop();
stack.push(n2/n1);
} else {
stack.push(map.get(s.charAt(i)));
}
}
System.out.printf("%.2f", stack.pop());
}
}