from bisect import bisect_left N, M, K = map(int, input().split()) op, *B = input().split() B = [int(x) for x in B] A = [int(input()) for _ in range(N)] B.sort() L = [K - a for a in A] if op == '+' else [(K + a - 1) // a for a in A] c = 0 for l in L: c += bisect_left(B, l) ans = N * M - c print(ans)