#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 10;
int w[maxn], h[maxn], n;
bool vis[maxn];
int ans = 0x3f3f3f3f;
void solve(int fuck) {
  priority_queue<int, vector<int> > q;
  int sum = 0, lie = 0;
  memset(vis, 0, sizeof(vis));
  for (int i = 1; i <= n; i++) {
    if (h[i] > fuck) {
      if (w[i] > fuck) return;
      sum += h[i];
      vis[i] = 1;
      lie++;
    }
  }
  for (int i = 1; i <= n; i++)
    if (!vis[i]) {
      if (w[i] <= fuck) q.push(w[i] - h[i]);
      sum += w[i];
    }
  while (lie < n / 2 && !q.empty()) {
    int temp = q.top();
    q.pop();
    if (temp > 0)
      sum -= temp, lie++;
    else
      break;
  }
  if (lie <= n / 2) ans = min(ans, fuck * sum);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d%d", &w[i], &h[i]);
  for (int i = 0; i <= 1000; i++) solve(i);
  printf("%d\n", ans);
}
