#include <bits/stdc++.h>
using namespace std;
const long long UNDEF = -1;
const long long INF = 2e9;
template <typename T>
inline bool chkmax(T &aa, T bb) {
  return aa < bb ? aa = bb, true : false;
}
template <typename T>
inline bool chkmin(T &aa, T bb) {
  return aa > bb ? aa = bb, true : false;
}
const int mn = 1e3 + 4;
int vw[mn], vh[mn];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &vw[i], &vh[i]);
  }
  int ans = INF;
  for (int H = 1; H <= 1000; H++) {
    vector<int> v;
    bool ok = true;
    int left = n / 2;
    int sumw = 0;
    for (int i = 0; i < n; i++) {
      int w = vw[i], h = vh[i];
      int orig = -1;
      if (h <= H) {
        orig = w;
      }
      int flip = -1;
      if (w <= H) {
        flip = h;
      }
      if (orig == -1 && flip == -1) {
        ok = false;
        break;
      } else if (orig == -1) {
        left--;
        sumw += h;
      } else if (flip == -1) {
        sumw += w;
      } else {
        sumw += w;
        int savings = max(0, w - h);
        v.push_back(savings);
      }
    }
    if (left < 0 || !ok) continue;
    sort(v.begin(), v.end(), greater<int>());
    for (auto &w : v) {
      if (left <= 0) break;
      sumw -= w;
      left--;
    }
    chkmin(ans, sumw * H);
  }
  printf("%d\n", ans);
}
