#include <bits/stdc++.h>
using namespace std;
struct pho {
  int w, h, flag;
  int dif;
  bool operator<(const pho &a) const { return a.dif < dif; }
} pix[1010];
bool cmp(pho a, pho b) { return a.h > b.h; }
int main() {
  int n, ans, o = 0, w;
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &pix[i].w, &pix[i].h);
    pix[i].dif = pix[i].w - pix[i].h;
    pix[i].flag = 0;
  }
  ans = (1 << 30);
  int ok = n / 2, cat;
  for (int h = 1; h <= 1000; h++) {
    sort(pix, pix + n, cmp);
    for (int i = 0; i < n; i++) pix[i].flag = 0;
    o = 1;
    cat = ok;
    w = 0;
    for (int i = 0; o && i < n; i++) {
      if (pix[i].h <= h || cat < 0) break;
      if (pix[i].h > h && pix[i].w > h) o = 0;
      pix[i].flag = 1;
      cat--;
      w += pix[i].h;
    }
    if (cat < 0 || !o) continue;
    sort(pix, pix + n);
    for (int i = 0; i < n; i++) {
      if (pix[i].flag) continue;
      if (cat && pix[i].dif > 0) {
        if (pix[i].w <= h) {
          cat--;
          w += pix[i].h;
        } else {
          w += pix[i].w;
        }
      } else {
        w += pix[i].w;
      }
    }
    if (w * h < ans) ans = w * h;
  }
  cout << ans << endl;
}
