#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
const int INF = 0x3f3f3f3f;
int n, w[N], h[N];
int maxx;
int sum, sum1, ans = INF;
inline void fuck(int id, int tot) {
  sum1 = sum;
  priority_queue<int> q;
  int tall;
  if (tot == 1)
    tall = w[id], sum1 = sum1 - w[id] + h[id];
  else
    tall = h[id];
  for (int i = 1; i <= n; ++i) {
    if (i == id) continue;
    if (w[i] > tall && h[i] > tall) return;
    if (w[i] > tall || h[i] > tall) {
      if (h[i] > tall) sum1 = sum1 - w[i] + h[i], tot++;
    } else if (w[i] <= tall && h[i] <= tall) {
      q.push(w[i] - h[i]);
    }
  }
  if (tot > n / 2) return;
  while (!q.empty()) {
    tot++;
    if (tot > n / 2) break;
    int now = q.top();
    q.pop();
    if (now <= 0) break;
    sum1 -= now;
  }
  ans = min(ans, sum1 * tall);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d%d", &w[i], &h[i]), sum += w[i];
  for (int i = 1; i <= n; ++i) {
    fuck(i, 0);
    fuck(i, 1);
  }
  printf("%d", ans);
}
