#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000 + 10;
int h[maxn], w[maxn];
vector<int> need_rotate;
vector<int> can_rotate;
bool cmp(int a, int b) { return w[a] - h[a] > w[b] - h[b]; }
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> w[i] >> h[i];
  }
  int ans = 2 * 1e9;
  for (int H = 1; H <= 1000; ++H) {
    need_rotate.clear();
    can_rotate.clear();
    int i;
    for (i = 0; i < n; ++i) {
      if (w[i] > H && h[i] > H) {
        break;
      }
      if (h[i] > H) {
        need_rotate.push_back(i);
      } else {
        can_rotate.push_back(i);
      }
    }
    if (i < n || need_rotate.size() > n / 2) continue;
    sort(can_rotate.begin(), can_rotate.end(), cmp);
    int s = 0, cnt = n / 2;
    for (i = 0; i < cnt && i < need_rotate.size(); ++i) {
      int idx = need_rotate[i];
      s += H * h[idx];
    }
    cnt -= i;
    for (i = 0; i < can_rotate.size(); ++i) {
      int idx = can_rotate[i];
      if (cnt && w[idx] > h[idx] && w[idx] <= H) {
        s += H * h[idx];
        cnt--;
      } else {
        s += H * w[idx];
      }
    }
    ans = min(ans, s);
  }
  cout << ans << endl;
  return 0;
}
