import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; import java.util.*; public class Main { static List divisor(int n) { List list = new ArrayList(); for (int i=1;i<=Math.sqrt(n);i++) { if (n%i==0) { list.add(i); if ((long)i*i!=n) { list.add(n/i); } } } Collections.sort(list); return list; } static long gcd(long a,long b) { long temp; while ((temp=a%b)!=0) { a=b; b=temp; } return b; } public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream); int N = in.nextInt(); int M = in.nextInt(); long K = in.nextInt(); char op = in.next().charAt(0); long[] B = new long[M]; long[] A = new long[N]; // long B_sum = 0L; // long A_sum = 0L; HashMap map = new HashMap(); HashMap mul_map = new HashMap(); for (int i=0;i mul_map_A = new HashMap(); for (int i=0;i keys = new ArrayList(mul_map.keySet()); ArrayList vals = new ArrayList(mul_map.values()); ArrayList keys_A = new ArrayList(mul_map_A.keySet()); ArrayList vals_A = new ArrayList(mul_map_A.values()); // out.println(mul_map); // out.println(mul_map_A); long ans_final = 0; for (int i=0;i diviser = new ArrayList(divisor((int)K)); // out.println(diviser); HashMap map_map = new HashMap(); for (int i=0;io1>=o2?1:-1); // ans += M-index; // } // out.println(ans); out.close(); } static class InputReader { public BufferedReader reader; public StringTokenizer tokenizer; public InputReader(InputStream stream) { reader = new BufferedReader(new InputStreamReader(stream), 32768); tokenizer = null; } public String next() { while (tokenizer == null || !tokenizer.hasMoreTokens()) { try { tokenizer = new StringTokenizer(reader.readLine()); } catch (IOException e) { throw new RuntimeException(e); } } return tokenizer.nextToken(); } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } } }