#include using namespace std; using i64 = long long; #define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++) int main(){ i64 p,q; cin >> p >> q; int N; cin >> N; set st; i64 ans = 0; rep(i,0,N - 1){ int r; cin >> r; if(st.count(r)){ ans += p + q; } st.insert(r); } cout << ans << endl; }