#!/usr/bin/env python3 # %% import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines # %% import numpy as np # %% N, M, K = map(int, readline().split()) op = read(1).decode() BA = np.array(read().split(), np.int64) # %% B = BA[:M] A = BA[M:] # %% A.sort() B.sort() # %% if op == '+': answer = np.sum(N - np.searchsorted(A, (K - B))) else: answer = np.sum(N - np.searchsorted(A, (K + B - 1) // B)) print(answer)