#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
int x[1111] = {0};
int y[1111] = {0};
int n, mmin, mmax, sum;
int ans = 1000000000;
priority_queue<int> q;
void solve(int k) {
  int xx = sum;
  while (!q.empty()) q.pop();
  int res = n / 2;
  for (int i = 1; i <= n; i++) {
    if (y[i] > k)
      res--, xx += y[i] - x[i];
    else if (x[i] <= k)
      q.push(x[i] - y[i]);
  }
  if (res < 0) return;
  while (res--) {
    if (q.empty()) break;
    if (q.top() <= 0) break;
    xx -= q.top();
    q.pop();
  }
  ans = min(ans, xx * k);
}
int main() {
  int tp = 0;
  tp++;
  mmin = 0;
  mmax = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    cin >> x[i] >> y[i], sum += x[i], mmin = max(mmin, min(x[i], y[i])),
                                      mmax = max(mmax, max(x[i], y[i]));
  for (int i = mmin; i <= mmax; i++) solve(i);
  cout << ans << endl;
  return 0;
}
