#include #define rep(i,a,n) for (int i = a;i < n;i++) #define per(i,n,a) for (int i = n-1;i >= a;i--) using namespace std; int p1,p2,n,ans; int main() { cin >> p1 >> p2 >> n; set used; rep(i, 0, n) { int r; cin >> r; if (used.count(r)){ ans += p1 + p2; }else{ used.insert(r); } } cout << ans << endl; }