#include <bits/stdc++.h>
using namespace std;
int i, j, k, n, m, s, t, ans, sum, B, Time, tot;
struct node {
  int w, h, d;
} a[10005];
int flag[10005];
int c[10005];
bool cmp(const node &x, const node &y) { return x.d > y.d; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &a[i].w, &a[i].h);
    c[++tot] = a[i].w;
    c[++tot] = a[i].h;
    a[i].d = a[i].w - a[i].h;
    sum += a[i].w;
    B = max(B, min(a[i].w, a[i].h));
  }
  sort(a + 1, a + 1 + n, cmp);
  ans = 1000000000;
  for (int i = 1; i <= tot; i++)
    if (c[i] >= B) {
      Time++;
      int maxh = c[i], num = n / 2, s = sum;
      for (int j = 1; j <= n; j++)
        if (a[j].h > maxh) {
          flag[j] = Time;
          num--;
          s -= a[j].d;
        }
      for (int j = 1; j <= n; j++)
        if (num > 0 && flag[j] != Time && a[j].d > 0 && a[j].w <= maxh) {
          num--;
          s -= a[j].d;
          flag[j] = Time;
        }
      if (num >= 0) ans = min(ans, maxh * s);
    }
  cout << ans << endl;
  return 0;
}
