N,M,K = map(int,input().split()) op,*B = input().split() A = [int(input()) for _ in range(N)] B = [int(i) for i in B] A.sort() B.sort() from bisect import bisect_left ans = 0 def mul_border(X,a,k): if X[0]*a >= k: return 0 elif X[-1]*a1: mid = (y+x)//2 if X[mid]*a >= K: y = mid else: x = mid return y def sum_border(X,a,k): if X[0]+a >= k: return 0 elif X[-1]+a1: mid = (y+x)//2 if X[mid]+a >= K: y = mid else: x = mid return y if op == '*': for i in range(M): b = B[i] ans += N - mul_border(A,b,K) else: for i in range(M): b = B[i] ans += N - sum_border(A,b,K) print(ans)