import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); StringBuilder sb = new StringBuilder(); int p1 = sc.nextInt(); int p2 = sc.nextInt(); int n = sc.nextInt(); int count = 0; List list = new ArrayList<>(); for(int i = 0 ; i < n; i++) { int r = sc.nextInt(); if(list.contains(r)) { count++; } else { list.add(r); } } System.out.println( count*(p1+p2) ); } }