#include using namespace std; int main() { int p1,p2,n; cin >> p1 >> p2 >> n; int r,flag[1000] = {},ans = 0; for(int i = 0; i < n; i++){ cin >> r; if(flag[r] == 1) ans++; else flag[r]++; } cout << (p1 + p2) * ans << endl; return 0; }