#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1005;
inline long long rd() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 1) + (x << 3) + ch - '0';
    ch = getchar();
  }
  return x * f;
}
long long n, w[MAXN], h[MAXN];
long long ans = 1e18 + 1, sum;
long long cnt, upd[MAXN];
inline bool cmp(long long x, long long y) { return x > y; }
inline bool check(long long x) {
  long long k = 0;
  cnt = 0;
  for (register long long i = 1; i <= n; i++) {
    if (w[i] > x && h[i] > x) return false;
    if (h[i] > x && w[i] <= x)
      k++, sum += h[i], sum -= w[i];
    else if (h[i] <= x && w[i] <= x)
      upd[++cnt] = w[i] - h[i];
    sum += w[i];
  }
  if (k > n / 2) return false;
  sort(upd + 1, upd + 1 + cnt, cmp);
  long long res = n / 2 - k;
  for (register long long i = 1; i <= res && i <= cnt; i++) {
    if (upd[i] <= 0) break;
    sum -= upd[i];
  }
  sum *= x;
  return true;
}
signed main() {
  n = rd();
  long long mx = 0;
  for (register long long i = 1; i <= n; i++)
    w[i] = rd(), h[i] = rd(), mx = max(w[i], max(mx, h[i]));
  for (register long long i = 1; i <= mx; i++) {
    sum = 0;
    if (!check(i)) continue;
    ans = min(ans, sum);
  }
  printf("%lld", ans);
  return 0;
}
