#include <bits/stdc++.h>
using namespace std;
int N, M;
long long Ans;
struct rec {
  int w, h, s, k;
  rec() {}
  rec(int a, int b, int c, int i) {
    w = a;
    h = b;
    s = c;
    k = i;
  }
} P[1010], Q[1010];
int vis[1010];
bool cmp_h(const rec &a, const rec &b) { return a.h > b.h; }
bool cmp_s(const rec &a, const rec &b) { return a.s > b.s; }
long long sumw(int maxh) {
  long long sum = 0;
  int cnt = 0;
  for (int i = 1; i <= N; ++i) {
    if (P[i].h <= maxh) break;
    int s = 1e10;
    if (P[i].w <= maxh && cnt < M) {
      ++cnt;
      vis[P[i].k] = maxh;
      s = P[i].h;
    }
    sum += s;
  }
  for (int i = 1; i <= N; ++i)
    if (vis[Q[i].k] != maxh) {
      int s = Q[i].w;
      if (Q[i].w <= maxh && cnt < M && s > Q[i].h) {
        ++cnt;
        vis[Q[i].k] = maxh;
        s = Q[i].h;
      }
      sum += s;
    }
  return sum;
}
int main() {
  scanf("%d", &N);
  M = N / 2;
  for (int i = 1; i <= N; ++i) {
    int w, h;
    scanf("%d%d", &w, &h);
    Q[i] = P[i] = rec(w, h, w - h, i);
  }
  sort(P + 1, P + N + 1, cmp_h);
  sort(Q + 1, Q + N + 1, cmp_s);
  Ans = 1e9;
  for (int hi = 1; hi <= 1000; ++hi) {
    Ans = min(Ans, (long long)hi * sumw(hi));
  }
  printf("%lld\n", Ans);
}
