#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 5;
const long long INF = 1e18;
long long ans = INF;
int w[N], h[N];
vector<int> v;
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> w[i] >> h[i];
    v.push_back(w[i]);
    v.push_back(h[i]);
  }
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  int sz = v.size();
  for (int i = sz - 1; i >= 0; --i) {
    long long ww = 0;
    int ret = 0, cnt = 0;
    vector<int> vec;
    for (int j = 0; j < n; ++j) {
      if (h[j] > v[i] && w[j] > v[i]) {
        ww = INF;
        ret = 1;
        break;
      }
      if (h[j] > v[i]) {
        if (cnt >= n / 2) {
          ww = INF;
          break;
        }
        ww += h[j];
        cnt++;
        continue;
      }
      if (h[j] < w[j] && w[j] <= v[i]) {
        vec.push_back(w[j] - h[j]);
      }
      ww += w[j];
    }
    if (ret) break;
    if (ww == INF) continue;
    sort(vec.begin(), vec.end(), [](int a, int b) { return a > b; });
    cnt = n / 2 - cnt;
    cnt = min(cnt, (int)vec.size());
    for (int j = 0; j < cnt; ++j) ww -= vec[j];
    ans = min(ans, (long long)ww * v[i]);
    if (ret) break;
  }
  cout << ans << "\n";
}
