#include using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(0); int p1, p2; cin >> p1 >> p2; int n; cin >> n; int room[1000] = {0}; long long ans = 0; while(n--) { int r; cin >> r; if(!room[r]) room[r] = 1; else { ans += p1 + p2; } } cout << ans << endl; return 0; }