#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  vector<pair<long long, long long> > v(n);
  long long maxi = n / 2;
  for (long long i = 0; i < n; ++i) {
    cin >> v[i].second >> v[i].first;
  }
  long long mm = 1e9;
  mm = mm * mm;
  for (long long i = 0; i < n; ++i) {
    long long cont = 0;
    long long suma = v[i].second;
    vector<long long> r(0);
    bool pos = true;
    for (long long j = 0; j < n; ++j) {
      if (j != i) {
        if (v[j].first > v[i].first) {
          if (v[j].second <= v[i].first) {
            suma += v[j].first;
            ++cont;
            if (cont > maxi) {
              pos = false;
            }
          } else {
            pos = false;
          }
        } else {
          suma += v[j].second;
          if (v[j].second <= v[i].first) r.push_back(v[j].first - v[j].second);
        }
      }
    }
    if (pos) {
      sort(r.begin(), r.end());
      for (long long j = 0; j < (long long)r.size() and cont < maxi; ++j) {
        if (r[j] < 0) {
          ++cont;
          suma += r[j];
        }
      }
      mm = min(suma * v[i].first, mm);
    }
    pos = true;
    swap(v[i].second, v[i].first);
    cont = 1;
    if (cont > maxi) pos = false;
    suma = v[i].second;
    r = vector<long long>(0);
    for (long long j = 0; j < n; ++j) {
      if (j != i) {
        if (v[j].first > v[i].first) {
          if (v[j].second <= v[i].first) {
            suma += v[j].first;
            ++cont;
            if (cont > maxi) pos = false;
          } else {
            pos = false;
          }
        } else {
          suma += v[j].second;
          if (v[j].second <= v[i].first) r.push_back(v[j].first - v[j].second);
        }
      }
    }
    if (pos) {
      sort(r.begin(), r.end());
      for (long long j = 0; j < (long long)r.size() and cont < maxi; ++j) {
        if (r[j] < 0) {
          ++cont;
          suma += r[j];
        }
      }
      mm = min(suma * v[i].first, mm);
    }
    swap(v[i].second, v[i].first);
  }
  cout << mm << endl;
}
