#include using namespace std; int main() { int p1, p2, n; cin >> p1 >> p2 >> n; int puni[1001]{}; for (int i = 0; i < n; i++) { int r; cin >> r; puni[r]++; } int ans = 0; for (int i = 0; i < 1001; i++) { ans += max(0, (puni[i] - 1) * (p1 + p2)); } cout << ans << endl; return 0; }