#include <bits/stdc++.h>
using namespace std;
int n, ans = 1000000100, w;
pair<int, int> a[1010];
bool cmp(pair<int, int> x, pair<int, int> y) { return x.second > y.second; }
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    a[i] = make_pair(x, y);
    w += x;
  }
  int kol = 0;
  int w = 0;
  bool exception = false;
  vector<int> candidate;
  for (int h = 1; h <= 1000; h++) {
    exception = false;
    kol = 0;
    w = 0;
    for (int i = 0; i < n; i++) {
      if (a[i].second <= h) {
        w += a[i].first;
        continue;
      } else {
        if (a[i].first <= h) {
          kol++;
          w += a[i].second;
        } else {
          exception = true;
          break;
        }
      }
    }
    candidate.clear();
    for (int i = 0; i < n; i++) {
      if (kol >= n / 2) break;
      if ((a[i].first <= h) && (a[i].first > a[i].second)) {
        candidate.push_back(a[i].first - a[i].second);
      }
    }
    sort(candidate.rbegin(), candidate.rend());
    for (int i = 0; (i < n / 2 - kol) && (i < candidate.size()); i++) {
      w -= candidate[i];
    }
    if (!exception && kol <= n / 2) {
      ans = min(ans, h * w);
    }
  }
  cout << ans;
}
