import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int k = sc.nextInt(); char op = sc.next().charAt(0); long[] arrB = new long[m]; for (int i = 0; i < m; i++) { arrB[i] = sc.nextInt(); } Arrays.sort(arrB); long[] arrA = new long[n]; for (int i = 0; i < n; i++) { arrA[i] = sc.nextInt(); } Arrays.sort(arrA); int idxB = m - 1; long count = 0; if (op == '+') { for (int i = 0; i < n; i++) { while (idxB >= 1 && arrB[idxB - 1] + arrA[i] >= k) { idxB--; } if (arrB[idxB] + arrA[i] >= k) { count += m - idxB; } } } else { for (int i = 0; i < n; i++) { while (idxB >= 1 && arrB[idxB - 1] * arrA[i] >= k) { idxB--; } if (arrB[idxB] * arrA[i] >= k) { count += m - idxB; } } } System.out.println(count); } }