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 { public static boolean isOK(int index, long key, long[] a, char op) { if (a[index] >= key) return true; else return false; } public static int binary_search(long key, long[] a, char op) { int left = -1; int right = a.length; while (right - left > 1) { int mid = left + (right - left) / 2; if (isOK(mid, key, a, op)) right = mid; else left = mid; } return right; } 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(); int K = in.nextInt(); String S = in.next(); Long[] B = new Long[M]; Long[] A = new Long[N]; // long B_sum = 0L; // long A_sum = 0L; for (int i=0;io1>=o2?1:-1); ans += M-index; } out.println(ans); // B_sum%=K; // A_sum%=K; // if (S.charAt(0)=='+') { // out.println((N*B_sum%K+M*A_sum%K)%K); // } else { // S.charAt(0)=='*' // long ans = 0L; // out.println(B_sum*A_sum%K); // } 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()); } } }