#include using namespace std; int main() { int p1, p2, n; std::unordered_map ump ; cin >> p1 >> p2 >> n; int tmp; for (int i = 0; i < n; i++) { cin >> tmp; ump[tmp]++; } int ct = 0; for (auto i : ump) { if (i.second >= 2) { ct += i.second - 1; } } int ans = (p1 + p2) * ct; cout << ans << endl; return 0; }