import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] sa = br.readLine().split(" "); int n = Integer.parseInt(sa[0]); int m = Integer.parseInt(sa[1]); int k = Integer.parseInt(sa[2]); sa = br.readLine().split(" "); String s = sa[0]; double[] b = new double[m]; for (int i = 0; i < b.length; i++) { b[i] = Long.parseLong(sa[i + 1]); } long[] a = new long[n]; for (int i = 0; i < a.length; i++) { a[i] = Long.parseLong(br.readLine()); } br.close(); Arrays.parallelSort(a); Arrays.parallelSort(b); long ans = 0; for (int i = 0; i < a.length; i++) { long v = 0; if ("+".equals(s)) { v = k - a[i]; } else { v = (k + a[i] - 1) / a[i]; } int idx = Arrays.binarySearch(b, v - 0.5); idx = ~idx; ans += m - idx; } System.out.println(ans); } }