import java.util.Scanner; import java.util.*; public class solve{ 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++){ if(!list.contains(R[i])){ list.add(R[i]); for(int j = i+1; j < N; j++){ if(R[i] == R[j]){ count++; } } } } loss = P1 * count + P2 * count; System.out.println(loss); } }