#include #define rep(i, ss, ee) for (int i = ss; i < ee; ++i) using namespace std; void solve() { int N, p1, p2, r; cin >> p1 >> p2 >> N; map m; rep(i, 0, N) { cin >> r; m[r]++; } int sum = 0; for (auto e : m) if (e.second > 1) sum += (e.second - 1); cout << (p1 + p2) * sum << endl; } int main() { cin.tie(0); ios::sync_with_stdio(false); solve(); getchar(); }