#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const int MAXN = 2000;
int N;
long long W[MAXN];
long long H[MAXN];
long long solve(long long height) {
  int numdown = N / 2;
  vector<long long> gains;
  long long width = 0;
  for (int i = 0; i < N; i++) {
    long long w = W[i], h = H[i];
    if (w > height && h > height) {
      return INF;
    } else if (w > height) {
      width += w;
    } else if (h > height) {
      numdown--;
      width += h;
    } else {
      width += w;
      if (h < w) gains.push_back(w - h);
    }
  }
  if (numdown < 0) return INF;
  sort(gains.begin(), gains.end());
  while (numdown && !gains.empty()) {
    numdown--;
    width -= gains.back();
    gains.pop_back();
  }
  return width * height;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> W[i] >> H[i];
  }
  long long res = INF;
  for (int i = 0; i < 1500; i++) {
    long long v = solve(i);
    res = min(res, v);
  }
  cout << res << '\n';
  return 0;
}
