import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Scanner; import java.util.Comparator; import java.util.ArrayList; /** * Built using CHelper plug-in * Actual solution is at the top * * @author silviase */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; Scanner in = new Scanner(inputStream); PrintWriter out = new PrintWriter(outputStream); nmCalc solver = new nmCalc(); solver.solve(1, in, out); out.close(); } static class nmCalc { public void solve(int testNumber, Scanner in, PrintWriter out) { // 愚直だと死んでしまうので二分探索かしゃくとりだけど尺取り法でよさそう…? // どっちも出してどっちもACすればええやん!人生は冒険や! int n = in.nextInt(); int m = in.nextInt(); int k = in.nextInt(); long ans = 0; String op = in.next(); ArrayList min2max = new ArrayList<>(); ArrayList max2min = new ArrayList<>(); for (int i = 0; i < m; i++) { min2max.add(in.nextLong()); } for (int i = 0; i < n; i++) { max2min.add(in.nextLong()); } min2max.sort(Comparator.naturalOrder()); max2min.sort(Comparator.reverseOrder()); int index = 0; for (Long l : min2max) { while (index < n) { if (op.charAt(0) == '+') { if (l + max2min.get(index) < k) { break; } } else if (op.charAt(0) == '*') { if (l * max2min.get(index) < k) { break; } } index++; } ans += index; // out.println(ans); } out.println(ans); } } }