#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e17;
int N;
long long W[1005], H[1005];
long long process(int h) {
  vector<long long> save;
  int cnt = 0;
  long long width = 0;
  for (int i = 0; i < N; i++) {
    if (W[i] > h && H[i] > h)
      return inf;
    else if (W[i] <= h && H[i] > h) {
      width += H[i];
      cnt++;
    } else if (W[i] > h && H[i] <= h)
      width += W[i];
    else {
      width += W[i];
      if (W[i] > H[i]) save.push_back(H[i] - W[i]);
    }
  }
  if (cnt > N / 2) return inf;
  sort(save.begin(), save.end());
  for (int i = 0; i < save.size() && i < (N / 2 - cnt); i++) width += save[i];
  return width * h;
}
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) cin >> W[i] >> H[i];
  long long best = inf;
  for (int h = 1; h <= 1005; h++) best = min(best, process(h));
  cout << best;
}
