from bisect import bisect_left from math import ceil n,m,k=map(int,input().split()) op,*b=input().split() b=sorted(list(map(int,b))) a=sorted(list(int(input()) for _ in range(n))) ans=0 if op=='+': for an in a: ans+=m-bisect_left(b,max(k-an,0)) else: for an in a: ans+=m-bisect_left(b,ceil(k/an)) print(ans)