import bisect n, m, k = map(int, input().split()) line = input().split() op = line[0] B = list(map(int, line[1:])) A = [int(input()) for _ in range(n)] B.sort() f = (lambda a,b: a+b) if op == '+' else (lambda a,b: a*b) rf = (lambda a,b: a-b) if op == '+' else (lambda a,b: a/b) ans = 0 for i in range(n): a = A[i] x = bisect.bisect_left(B, rf(k,a)) ans += m-x print(ans)