#include <bits/stdc++.h>
using namespace std;
int w[1005], h[1005], v[1005];
int n, ans = 0x3f3f3f3f;
void solve(int H) {
  int sum = 0, cnt = 0, cc = 0;
  for (int i = 0; i < n; ++i) {
    if (h[i] > H && w[i] > H) return;
    if (h[i] > H) {
      ++cnt;
      sum += h[i];
      continue;
    }
    if (w[i] > H) {
      sum += w[i];
      continue;
    }
    sum += w[i];
    v[cc++] = h[i] - w[i];
  }
  if (cnt > n / 2) return;
  sort(v, v + cc);
  cnt = n / 2 - cnt;
  for (int i = 0; i < cc && i < cnt; ++i) {
    if (v[i] >= 0) break;
    sum += v[i];
  }
  ans = min(ans, sum * H);
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d%d", w + i, h + i);
  for (int i = 1; i <= 1000; ++i) solve(i);
  printf("%d\n", ans);
  return 0;
}
