ll@N,@M,@K;char@O;ll@B[M],@A[N];sort(A,A+N),sort(B,B+M);wt(N*M-sum[ll][i,0,N](lower_bound(B,B+M,O&1?K-A[i]:(K+A[i]-1)/A[i])-B));