#include <bits/stdc++.h>
using namespace std;
#define int long long
vector<int> kuhn(vector<vector<int>>& g, int n, int m) {
vector<int> a(n), b(m, -1);
auto dfs = [&](auto self, int i) {
if (a[i]) {
return 0;
}
a[i] = 1;
for (int j : g[i]) {
if (b[j] == -1 || self(self, b[j])) {
b[j] = i;
return 1;
}
}
return 0;
};
for (int i = 0; i < n; i++) {
fill(a.begin(), a.end(), 0);
dfs(dfs, i);
}
return b;
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N,A,B;
cin>>N>>A>>B;
vector<int>x(N),y(N);
for(int i=0;i<N;i++){
cin>>x[i]>>y[i];
}
vector<int>xx=x,yy=y;
sort(xx.begin(),xx.end());
sort(yy.begin(),yy.end());
xx.erase(unique(xx.begin(),xx.end()),xx.end());
yy.erase(unique(yy.begin(),yy.end()),yy.end());
vector<vector<int>>g(xx.size());
for(int i=0;i<N;i++){
x[i]=lower_bound(xx.begin(),xx.end(),x[i])-xx.begin();
y[i]=lower_bound(yy.begin(),yy.end(),y[i])-yy.begin();
g[x[i]].push_back(y[i]);
}
vector<int>b=kuhn(g,xx.size(),yy.size());
int no=count(b.begin(),b.end(),-1);
cout<<B*(xx.size()+yy.size())+A*(xx.size()+no)<<'\n';
return 0;
}