#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-6;
const double PI = 3.14159265358979323846264338f;
const double pi = acos(-1.0);
const int inf = 0x3f3f3f3f;
const long long mod = 1e9 + 7;
const int MAXN = 1005;
inline int read() {
  int c = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    c = c * 10 + ch - '0';
    ch = getchar();
  }
  return c * f;
}
struct node {
  int w, h;
} e[MAXN];
int n;
int ans = inf;
bool vis[MAXN];
int main() {
  n = read();
  for (int i = 1; i <= n; i++) {
    e[i].w = read();
    e[i].h = read();
  }
  auto solve = [](int x) -> void {
    memset(vis, false, sizeof(vis));
    priority_queue<int> q;
    int tot = 0;
    int w = 0;
    for (int i = 1; i <= n; i++) {
      if (e[i].h > x) {
        vis[i] = true;
        tot++;
        w += e[i].h;
        if (e[i].w > x) return;
      }
    }
    for (int i = 1; i <= n; i++) {
      if (!vis[i]) {
        if (e[i].w <= x) q.push(e[i].w - e[i].h);
        w += e[i].w;
      }
    }
    while (tot < n / 2 && !q.empty()) {
      int ww = q.top();
      q.pop();
      if (ww > 0) {
        w -= ww;
        tot++;
      } else
        break;
    }
    if (tot <= n / 2) ans = min(ans, w * x);
  };
  for (int i = 1; i <= 1000; i++) {
    solve(i);
  }
  cout << ans << "\n";
  return 0;
}
