#include <bits/stdc++.h>
using namespace std;
int n;
int w[5005], h[5005], wt[5005], ht[5005], sum[5005], tot;
int e[5005];
bool cmp(int x, int y) { return x > y; }
bool check(int x) {
  int fuck = n / 2;
  memcpy(ht + 1, h + 1, 4 * n);
  memcpy(wt + 1, w + 1, 4 * n);
  for (int i = 1; i <= n; i++) {
    if (ht[i] > x) {
      if (wt[i] <= x && fuck > 0) {
        swap(wt[i], ht[i]);
        fuck--;
      } else
        return 0;
    }
  }
  tot = 0;
  memset(sum, 0, sizeof(sum));
  for (int i = 1; i <= n; i++) {
    tot += wt[i];
  }
  for (int i = 1; i <= n; i++) {
    if (wt[i] <= x)
      sum[i] = wt[i] - ht[i];
    else
      sum[i] = -1;
  }
  sort(sum + 1, sum + n + 1, cmp);
  for (int i = 1; i <= n; i++) {
    if (sum[i] > 0 && fuck > 0) {
      fuck--;
      tot -= sum[i];
    }
  }
  return 1;
}
int main() {
  int ans = 2000000000;
  scanf("%d", &n);
  int big;
  int ma = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &w[i], &h[i]);
    ma = max(ma, w[i]);
    ma = max(ma, h[i]);
  }
  for (int i = 1; i <= ma; i++) {
    if (check(i) == 0) continue;
    ans = min(ans, i * tot);
  }
  printf("%d\n", ans);
}
