#include using namespace std; typedef long long ll; int main() { int N, M; ll K; cin >> N >> M >> K; vector A(N); ll B[M]; string op; cin >> op; for (int i = 0; i < M; i++) { cin >> B[i]; } for (int i = 0; i < N; i++) { cin >> A[i]; } sort(A.begin(), A.end()); ll sum = 0; for (int i = 0; i < M; i++) { if (op == "+") { auto it = upper_bound(A.begin(), A.end(), K - B[i] - 1); sum += A.end() - it; } else { auto it = upper_bound(A.begin(), A.end(), K / B[i] - 1); sum += A.end() - it; } } cout << sum << "\n"; return 0; }