#include using namespace std; bool room[1001]; int main(){ int p1, p2, n; int ans = 0; cin >> p1 >> p2 >> n; for(int i=0; i < n; i++){ int tmp; cin >> tmp; if(room[tmp]) ans += p1 + p2; else room[tmp] = true; } cout << ans << endl; return 0; }