import java.util.Scanner; import java.util.*; public class slove{ public static void main(String[] args){ Scanner stdIn = new Scanner(System.in); int P1 = stdIn.nextInt(); int P2 = stdIn.nextInt(); int N = stdIn.nextInt(); int[] R = new int[N]; List list = new ArrayList(); int count = 0; int loss = 0; for(int i = 0; i < N; i++){ R[i] = stdIn.nextInt(); } for(int i = 0; i < N; i++){ for(int j = i+1; j < N; j++){ if(!list.contains(R[i])){ list.add(R[i]); if(R[i] == R[j]) count++; }else continue; } } loss = P1 * count + P2 * count; System.out.println(loss); } }