#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
bool cmp(std::pair<int, int> a, std::pair<int, int> b) {
  return a.first - a.second > b.first - b.second;
}
int main() {
  bool swapped[1000];
  int n;
  cin >> n;
  vector<std::pair<int, int> > rects(n);
  for (long long i = 0; i < (int)n; i++)
    cin >> rects[i].first >> rects[i].second;
  sort(rects.begin(), rects.end(), cmp);
  long long best = (1LL << 60);
  for (long long i = 1; i <= (int)1000; i++) {
    long long totalWidth = 0;
    int swapCount = 0;
    bool ok = true;
    for (long long j = 0; j < (int)n; j++) {
      swapped[j] = false;
      if (rects[j].first > i && rects[j].second > i) {
        ok = false;
        break;
      }
    }
    if (!ok) continue;
    for (long long j = 0; j < (int)n; j++) {
      if (rects[j].second > i) {
        if (swapCount < n / 2) {
          totalWidth += rects[j].second;
          swapCount++;
          swapped[j] = true;
        } else {
          ok = false;
          break;
        }
      }
    }
    if (!ok) continue;
    for (long long j = 0; j < (int)n; j++) {
      if (swapped[j]) continue;
      if (swapCount < n / 2 && rects[j].first <= i &&
          rects[j].first > rects[j].second) {
        totalWidth += rects[j].second;
        swapCount++;
      } else {
        totalWidth += rects[j].first;
      }
    }
    if (ok) best = min(best, totalWidth * i);
  }
  cout << best << endl;
  return 0;
}
