#include <bits/stdc++.h>
using namespace std;
int i, j, k, n, m, an;
int x[2010], y[2010], xx[2010], yy[2010], a[2010];
inline void work(int h) {
  int i, s = 0, t = 0, len = 0;
  for (i = 1; i <= n; i++) xx[i] = x[i], yy[i] = y[i];
  for (i = 1; i <= n; i++) {
    if (xx[i] > h && yy[i] > h) return;
    if (yy[i] > h) swap(xx[i], yy[i]), s++;
  }
  if (s * 2 > n) return;
  for (i = 1; i <= n; i++)
    if (xx[i] <= h && yy[i] <= h && xx[i] > yy[i]) a[++t] = xx[i] - yy[i];
  for (i = 1; i <= n; i++) len += xx[i];
  sort(a + 1, a + t + 1);
  reverse(a + 1, a + t + 1);
  for (i = 1; i <= min(t, n / 2 - s); i++) len -= a[i];
  an = min(an, len * h);
}
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d%d", &x[i], &y[i]);
  an = (int)2e9;
  for (i = 1; i <= 1000; i++) work(i);
  printf("%d\n", an);
  return 0;
}
