#include using namespace std; typedef int ll; #define REP(i,n) FOR(i,0,n) #define FOR(i,a,b) for(ll i=a;i vi; typedef vector> vvi; const ll INF = (1ll << 30); typedef pair pii; struct Edge{ ll s,t,c; }; typedef vector> Graph; typedef vector vpii; int main() { ll p1,p2; cin>>p1>>p2; ll n; cin>>n; unordered_map um; REP(i,n) { ll r; cin>>r; um[r]+=1; } ll ans=0; for(auto p:um) { ans+=(p.second-1)*(p1+p2); } cout<