#include using namespace std; int main() { int p1, p2; cin >> p1 >> p2; int N; cin >> N; int flag[1001] = {0}; int ans = 0; for (int i = 0; i < N; i++) { int a; cin >> a; if (flag[a] >= 1) { ans += p1 + p2; } flag[a]++; } cout << ans << endl; return 0; }