#include #include using namespace std; int main() { int P1, P2, N; cin >> P1 >> P2 >> N; map m; int ng_cnt = 0; for (int i = 0; i < N; i++) { int r; cin >> r; if (m.find(r) != m.end()) { ng_cnt++; continue; } m[r] = 1; } cout << (P1 + P2) * ng_cnt << endl; return 0; }