#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
struct data {
  int w, h;
} a[N];
int n, hh[N * 2];
int ord[N];
int H, W;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    scanf("%d%d", &a[i].w, &a[i].h), hh[++*hh] = a[i].w, hh[++*hh] = a[i].h;
  long long ans = (long long)1e18;
  for (int i = 1; i <= *hh; i++) {
    H = hh[i];
    W = 0;
    int r = n / 2;
    *ord = 0;
    for (int j = 1; j <= n; j++) {
      if (a[j].w <= a[j].h) {
        if (a[j].h <= H)
          W += a[j].w;
        else if (a[j].w <= H)
          W += a[j].h, r--;
        else
          r = -1;
      } else {
        if (a[j].w <= H)
          W += a[j].w, ord[++*ord] = a[j].w - a[j].h;
        else if (a[j].h <= H)
          W += a[j].w;
        else
          r = -1;
      }
    }
    if (r < 0) continue;
    nth_element(ord + 1, ord + min(r, *ord), ord + *ord + 1, greater<int>());
    for (int j = 1; j <= min(r, *ord); j++) W -= ord[j];
    ans = min(ans, 1LL * H * W);
  }
  printf("%I64d\n", ans);
}
