#include <bits/stdc++.h>
using namespace std;
const long long NN = 11011;
long long n, b[NN];
struct ppt {
  long long x, y;
} q[NN];
bool cmp(int x, int y) { return x > y; }
int main() {
  scanf("%lld", &n);
  long long i, j;
  for (i = 1; i <= n; i++) {
    scanf("%lld%lld", &q[i].x, &q[i].y);
  }
  long long ans = 99999999999999999ll;
  for (i = 1500; i >= 0; i--) {
    bool flag = true;
    long long t = 0, num = 0, m = 0;
    for (j = 1; j <= n; j++) {
      if (q[j].x > i && q[j].y > i)
        flag = false;
      else if (q[j].x <= i && q[j].y > i)
        num++, t += q[j].y;
      else if (q[j].x > i && q[j].y <= i)
        t += q[j].x;
      else if (q[j].x <= q[j].y)
        t += q[j].x;
      else
        t += q[j].x, b[++m] = q[j].x - q[j].y;
    }
    if (num + num > n) continue;
    if (!flag) continue;
    sort(b + 1, b + m + 1, cmp);
    for (long long k = 1; k + num <= n / 2 && k <= m; k++) t -= b[k];
    ans = min(ans, i * t);
  }
  printf("%lld\n", ans);
  return 0;
}
