#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:100000000")
using namespace std;
int total, ans = 1e9;
struct node {
  int w, h;
};
node el[1005];
bool flag[1005] = {0};
bool cmp(node a, node b) { return a.w - a.h > b.w - b.h; }
int op(int h, int re, int i, int w) {
  bool f = 0;
  for (int m = 1; m <= total; m++) {
    if (m != i) {
      if (el[m].w > h && el[m].h > h) {
        f = 1;
        break;
      } else if (el[m].h > h) {
        re--;
        flag[m] = 1;
        w += el[m].h;
      } else if (el[m].w > h) {
        flag[m] = 1;
        w += el[m].w;
      }
    }
  }
  if (f || re < 0) return 1e9;
  for (int m = 1; m <= total; m++)
    if (!flag[m]) {
      if (re > 0 && el[m].w > el[m].h) {
        re--;
        w += el[m].h;
      } else
        w += el[m].w;
    }
  return w * h;
}
int main() {
  cin >> total;
  for (int i = 1; i <= total; i++) cin >> el[i].w >> el[i].h;
  sort(el + 1, el + 1 + total, cmp);
  for (int i = 1; i <= total; i++) {
    memset(flag, 0, 1005);
    flag[i] = 1;
    int res = op(el[i].h, total >> 1, i, el[i].w);
    memset(flag, 0, 1005);
    flag[i] = 1;
    res = min(res, op(el[i].w, (total >> 1) - 1, i, el[i].h));
    ans = min(ans, res);
  }
  cout << ans;
  return 0;
}
