import sys sys.setrecursionlimit(1000000) N = int(input()) P, Q, R = map(float, input().split()) class vec: def __init__(self, x): self.x = x def __and__(self, other): return vec(self.x * other.x * (1.0 - R) + (1.0 - self.x * other.x) * R) def __or__(self, other): return vec( (1.0 - (1.0 - self.x) * (1.0 - other.x)) * (1.0 - R) + (1.0 - self.x) * (1.0 - other.x) * R ) def r(a, b): return vec(a.x * b.x * P + (1.0 - a.x * b.x) * Q) y = vec(1.0) n = vec(0.0) S = ( input() .replace("random", "r") .replace("and", "&") .replace("or", "|") .replace("YES", "y ") .replace("NO", "n ") .replace(" y", " ,y") .replace(" n", " ,n") .replace(" (", " ,(") .replace(" r", " ,r") .replace(")r", "),r") .replace(")n", "),n") .replace(")(", "),(") .replace(")r", "),r") ) s = eval(S) print(int(s.x * 100.0))