#include <bits/stdc++.h>
using namespace std;
long long BigMod(long long B, long long P, long long M) {
  long long R = 1;
  while (P > 0) {
    if (P % 2 == 1) {
      R = (R * B) % M;
    }
    P /= 2;
    B = (B * B) % M;
  }
  return R;
}
template <class T1>
void deb(T1 e1) {
  cout << e1 << endl;
}
template <class T1, class T2>
void deb(T1 e1, T2 e2) {
  cout << e1 << " " << e2 << endl;
}
template <class T1, class T2, class T3>
void deb(T1 e1, T2 e2, T3 e3) {
  cout << e1 << " " << e2 << " " << e3 << endl;
}
template <class T1, class T2, class T3, class T4>
void deb(T1 e1, T2 e2, T3 e3, T4 e4) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << endl;
}
template <class T1, class T2, class T3, class T4, class T5>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << endl;
}
template <class T1, class T2, class T3, class T4, class T5, class T6>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5, T6 e6) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << " " << e6
       << endl;
}
int n;
pair<int, int> val[1010];
int go(int totW, bool flag) {
  int res = 1000000010;
  for (int i = 0; i < n; i++) {
    int mxH = flag ? val[i].second : val[i].first;
    int lieneed = 0, totdiff = flag ? 0 : val[i].first - val[i].second;
    int addiW = 0;
    vector<int> diffs;
    for (int j = 0; j < n; j++) {
      if (val[j].second > mxH) {
        if (val[j].first > mxH)
          goto skip;
        else {
          lieneed++;
          addiW += val[j].first - val[j].second;
        }
      } else if (val[j].first <= mxH) {
        if (val[j].first > val[j].second) {
          diffs.push_back((val[j].first - val[j].second));
        }
      }
    }
    if (lieneed > n / 2)
      goto skip;
    else {
      totdiff = addiW;
      sort(diffs.rbegin(), diffs.rend());
      diffs.resize(min(((int)diffs.size()), n / 2 - lieneed));
      for (int i : diffs) totdiff += i;
      int curW = totW - totdiff;
      res = min(res, curW * mxH);
    }
  skip:
    continue;
  }
  return res;
}
int main() {
  scanf("%d", &n);
  int totW = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &val[i].first, &val[i].second);
    totW += val[i].first;
  }
  sort(val, val + n);
  int res = go(totW, true);
  res = min(res, go(totW, false));
  deb(res);
  return 0;
}
