#include using namespace std; typedef long long ll; int main() { int p1, p2; cin >> p1 >> p2; int n; cin >> n; set s; int ans = 0; for (int i = 0; i < n; ++i) { int r; cin >> r; if (s.find(r) != s.end()) { ans += p1 + p2; } else { s.insert(r); } } cout << ans << '\n'; return 0; }