#include #include int main(){ int P1, P2, N, R[101], M = 0, c = 0, i; scanf("%d%d", &P1, &P2); scanf("%d", &N); for (i = 0; i < N; i++) { scanf("%d", &R[i]); } // qsort((void *)R, N, sizeof(int) , int_sort); qsort((void *)R, N, sizeof(int) , NULL); for (i = 0; i < N; i++) { if (R[i] == M) { c++; } else { M = R[i]; } } printf("%d", c*(P1 + P2)); }