#include using namespace std; int main() { int P1, P2, N, R; cin >> P1 >> P2 >> N; vector V(1000); int ans = 0; while (cin >> R) { if (V.at(R)) ans += P1 + P2; V.at(R)++; } cout << ans << "\n"; }