import java.io.*; import java.util.*; public class Main_yukicoder586 { private static Scanner sc; private static Printer pr; private static void solve() { int p1 = sc.nextInt(); int p2 = sc.nextInt(); int n = sc.nextInt(); int[] r = new int[n]; int[] rr = new int[999]; for (int i = 0; i < n; i++) { r[i] = sc.nextInt(); rr[r[i] - 1]++; } long ans = 0; for (int i = 0; i < 999; i++) { if (rr[i] > 1) { ans += (long)(p1 + p2) * (rr[i] - 1); } } pr.println(ans); } // --------------------------------------------------- public static void main(String[] args) { sc = new Scanner(System.in); pr = new Printer(System.out); solve(); pr.close(); sc.close(); } private static class Printer extends PrintWriter { Printer(PrintStream out) { super(out); } } }