package m.shin; import java.util.ArrayList; import java.util.Scanner; public class Doublebooking { public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ Scanner s = new Scanner(System.in); int P1 = s.nextInt(); int P2 = s.nextInt(); int N = s.nextInt(); int c = 0; ArrayList roomnumber = new ArrayList<>(); for(int i = 0;i < N;i++){ int r = s.nextInt(); if(roomnumber.contains(r)){ c++; }else{ roomnumber.add(r); } } s.close(); System.out.println(c*(P1+P2)); } }