#include using namespace std; int main() { int a, b, n; cin >> a >> b >> n; set s; int ans = 0; for (int i = 0; i < n; i++) { int val; cin >> val; if (not s.insert(val).second) { ans += a + b; } } cout << ans << '\n'; return 0; }