#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1010;
const int mod = 1e9 + 7;
int N, K, sum, summ, used[MAXN];
pair<int, int> ar[MAXN];
vector<int> v;
bool comp(const pair<int, int> &a, const pair<int, int> &b) {
  return a.second < b.second;
}
int main() {
  int asd = 0;
  scanf(" %d", &N);
  K = N / 2;
  for (int i = 1; i <= N; i++) {
    scanf(" %d %d", &ar[i].first, &ar[i].second);
    summ += ar[i].first;
    asd = max(asd, ar[i].second);
    used[ar[i].first] = used[ar[i].second] = 1;
  }
  int ans = summ * asd;
  sort(ar + 1, ar + N + 1, comp);
  for (int i = 1, k; i <= 1000; i++) {
    if (!used[i]) continue;
    k = K;
    sum = summ;
    int last = N + 1, q = 0;
    for (int j = 1; j <= N; j++) {
      if (ar[j].first > i && ar[j].second > i) {
        k = -1;
        break;
      }
      if (ar[j].second > i) {
        k--;
        sum -= ar[j].first;
        sum += ar[j].second;
        if (!q) {
          q = 1;
          last = j;
        }
      }
    }
    if (k < 0) continue;
    v.clear();
    for (int j = 1; j < N; j++)
      if (ar[j].first <= i && ar[j].first > ar[j].second)
        v.push_back(ar[j].first - ar[j].second);
    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());
    for (int j = 0; j < (int)v.size(); j++)
      if (k > 0) {
        sum -= v[j];
        k--;
      }
    if (ans > sum * i) ans = sum * i;
  }
  printf("%d\n", ans);
  return 0;
}
