#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define REP(i,n) for(int i=0; i=b; --i) #define ALL(c) (c).begin(), (c).end() typedef long long ll; typedef vector VI; typedef vector VL; typedef vector VVL; typedef vector VVI; typedef pair P; typedef pair PL; int main() { int p1, p2; cin >> p1 >> p2; int n; cin >> n; set st; int ans = 0; REP(i,n){ int x; cin >> x; if (st.count(x)) ans += p1 + p2; else st.insert(x); } cout << ans << endl; return 0; }