#include <bits/stdc++.h>
using namespace std;
int n;
int h[1005], w[1005];
int solve(int d) {
  priority_queue<int> q;
  while (!q.empty()) q.pop();
  int cnt = 0, cnt2 = 0, sw = 0;
  for (int i = 1; i <= n; i++) {
    if (h[i] > d && w[i] > d) return -1;
    if (h[i] > d)
      sw += h[i], cnt++;
    else if (w[i] > d)
      sw += w[i];
    else
      sw += w[i], q.push(w[i] - h[i]), cnt2++;
  }
  if (cnt > n / 2) return -1;
  for (int i = 1; i <= cnt2 && cnt + i <= n / 2; i++) {
    int p = q.top();
    q.pop();
    if (p < 0) break;
    sw -= p;
  }
  return sw * d;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d%d", &w[i], &h[i]);
  int ans = 1e9;
  for (int curh = 1000; curh >= 1; curh--) {
    int x = solve(curh);
    if (x == -1) continue;
    ans = min(ans, x);
  }
  printf("%d", ans);
  return 0;
}
