#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MAXN = 50001;
vector<int> g[MAXN];
int vis[MAXN];
int mt[MAXN];
bool try_kuhn(int u, int iter) {
if (vis[u] == iter) return false;
vis[u] = iter;
for (int v : g[u]) {
if (mt[v] == -1 || try_kuhn(mt[v], iter)) {
mt[v] = u;
return true;
}
}
return false;
}
void solve() {
int n; ll a, b; cin >> n >> a >> b;
fill(mt, mt+MAXN, -1);
vector<pair<int, int>> v(n);
for (auto &[x, y] : v) cin >> x >> y;
vector<int> comp_x, comp_y;
for (auto [x, y] : v) {
comp_x.emplace_back(x);
comp_y.emplace_back(y);
}
sort(comp_x.begin(), comp_x.end());
sort(comp_y.begin(), comp_y.end());
comp_x.erase(unique(comp_x.begin(), comp_x.end()), comp_x.end());
comp_y.erase(unique(comp_y.begin(), comp_y.end()), comp_y.end());
for (auto &[x, y] : v) {
x = lower_bound(comp_x.begin(), comp_x.end(), x) - comp_x.begin();
y = lower_bound(comp_y.begin(), comp_y.end(), y) - comp_y.begin();
g[x].emplace_back(y);
}
int flow = 0;
for (int i = 0; i < comp_x.size(); i++) {
flow += try_kuhn(i, i+1);
}
ll cnt1 = comp_x.size() + comp_y.size();
ll cnt2 = 2 * comp_x.size() - flow;
ll ans = cnt1 * b + cnt2 * a;
cout << ans << "\n";
}
int main() {
ios::sync_with_stdio(0); cin.tie(0);
int t = 1;
// cin >> t;
while (t--) solve();
return 0;
}