#include <bits/stdc++.h>
using namespace std;
int n;
int h[1010], w[1010];
int ans = INT_MAX;
int main() {
  cin >> n;
  int d = 0;
  for (int i = 0; i < (n); i++) {
    cin >> w[i] >> h[i];
    d = max(d, min(h[i], w[i]));
  }
  for (int i = 1000; i >= d; --i) {
    int cnt = 0;
    int sum = 0;
    vector<int> vec;
    for (int j = 0; j < (n); j++) {
      if (h[j] > i) {
        ++cnt;
        sum += h[j];
      } else {
        if (h[j] - w[j] < 0 && i >= w[j]) {
          vec.push_back(h[j] - w[j]);
        }
        sum += w[j];
      }
    }
    sort((vec).begin(), (vec).end());
    if (cnt > n / 2) break;
    for (int j = 0; j < (vec.size()); j++) {
      if (cnt == n / 2) break;
      ++cnt;
      sum += vec[j];
    }
    ans = min(ans, sum * i);
  }
  cout << ans << endl;
  return 0;
}
