#include using namespace std; using ll = long long; using ld = long double; #define rep(i,n) for(int i=0;i<(int)(n);i++) #define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++) const ll mod = 1e9 + 7; const int INF = 1e9; int main() { cin.sync_with_stdio(false); int p1, p2; cin >> p1 >> p2; int N; cin >> N; bool r[1000] = {}; int ans = 0; rep(i, N) { int R; cin >> R; if (r[R] == true)ans += p1 + p2; else r[R] = true; } cout << ans << endl; return 0; }