#include using namespace std; int main() { int p1, p2, n; cin >> p1 >> p2 >> n; int c = 0; vector v(n, 0); for (int i = 0; i < n; i++) { int x; cin >> x; int r = count(v.begin(), v.end(), x); if (r) { c++; } else { v.push_back(x); } } cout << (p1 + p2) * c << endl; }