#include #include #include #include using namespace std; #define REP(i, j) for (int i = 0; i < (int)j; ++i) #define FOR(i, j, k) for (int i = (int)j; i < (int)k; ++i) #define SORT(v) sort(v.begin(), v.end()) #define REVERSE(v) reverse(v.begin(), v.end()) typedef complex P; int main() { cin.tie(0); ios::sync_with_stdio(false); int p1, p2, n; cin >> p1 >> p2 >> n; bool rb[999]; memset(rb, false, sizeof(rb)); int loss = 0; REP(i,n) { int r; cin >> r; if (rb[r] == false) { rb[r] = true; } else { loss += p1 + p2; } } cout << loss << endl; return 0; }