#include using namespace std; int main(){ int P1, P2, N; cin >> P1 >> P2 >> N; int tmp,R[999]={0}; for(int i =0; i> tmp; R[tmp-1]++; } int sum=0; for(int i=0;i<999; i++){ if(R[i]>1){ sum+=R[i]-1; } } cout << (P1+P2)*sum << endl; return 0; }