#include using namespace std; int main(void) { int p, q, n; cin >> p >> q >> n; map mp; for (int i = 0; i < n; i++) { int r; cin >> r; mp[r]++; } int ans = 0; for (auto i : mp) { ans += (i.second - 1) * (p + q); } cout << ans << endl; return 0; }