#include using namespace std; int main() { int P1, P2, N; cin >> P1 >> P2 >> N; vector R( 999 ); long long ans = 0; for( int i = 0; i < N; i++ ) { int r; cin >> r; r--; if( R[r] ) ans += P1 + P2; else R[r] = 1; } cout << ans << endl; }