#include using namespace std; int main() { int P1, P2, P, N, tmp; cin >> P1 >> P2; P = P1 + P2; cin >> N; map R; for(int i = 0; i < N; i++) { cin >> tmp; if(R.find(tmp) == R.end()) R[tmp] = 0; R[tmp]++; } int C = 0; for(auto it = R.begin(); it != R.end(); it++) { C += (it->second - 1) * P; } cout << C << endl; return 0; }