//Normal #define _GLIBCXX_DEBUG #define ll long long #include using namespace std; using Graph = vector>; void print(auto a){ cout << a; } void prints(auto a){ cout << a << " "; } void prints(){ cout << " "; } void printl(auto a){ cout << a << endl; } void printl(){ cout << endl; } void fix(int n){ cout << fixed << setprecision(n); } int main(){ int P1, P2; cin >> P1 >> P2; int N; cin >> N; int ans = 0; map mp; for(int i = 0; i < N; i++){ int R; cin >> R; if(mp[R] == 0){ mp[R]++; }else{ ans += P1 + P2; } } printl(ans); return 0; }