#include #include using namespace std; int main() { int P1, P2, N; cin >> P1 >> P2 >> N; set s; int loss = 0; for (int i = 0; i < N; i++) { int R; cin >> R; if (s.count(R) != 0) { loss += P1 + P2; continue; } s.insert(R); } cout << loss << endl; return 0; }