import bisect n,m,k = map(int,input().split()) B = list(input().split()) op = B[0] B = [int(i) for i in B[1:]] A = [int(input()) for _ in range(n)] B.sort() A.sort() cnt = 0 if op=='+': for b in B: dif = k-b idx = bisect.bisect_left(A, dif) cnt += n-idx else: for b in B: dif = k/b idx = bisect.bisect_left(A, dif) cnt += n-idx print(cnt)