#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long mpow(long long a, long long b, long long p = MOD) {
  a = a % p;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = (res * a) % p;
    a = (a * a) % p;
    b = b >> 1;
  }
  return res % p;
}
const long long N = 1e5 + 50;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  long long lim = n / 2;
  long long w[n], h[n];
  long long ans = 1e18;
  for (long long i = 0; i < n; i++) cin >> w[i] >> h[i];
  for (long long hh = 1; hh <= 1000; hh++) {
    long long w1[n], h1[n];
    bool f = true;
    long long cnt = lim;
    for (long long i = 0; i < n; i++) {
      if (h[i] > hh) {
        if (w[i] > hh) {
          f = false;
          break;
        } else {
          h1[i] = w[i];
          w1[i] = h[i];
          cnt--;
        }
      } else {
        h1[i] = h[i];
        w1[i] = w[i];
      }
    }
    if (!f) {
      continue;
    }
    if (cnt < 0) {
      continue;
    }
    long long s = 0;
    vector<long long> oo;
    for (long long i = 0; i < n; i++) {
      if (w1[i] <= hh) {
        s += w1[i];
        if (h1[i] < w1[i]) oo.push_back(w1[i] - h1[i]);
      } else {
        s += w1[i];
      }
    }
    sort((oo).begin(), (oo).end());
    for (long long i = (long long)oo.size() - 1; (i >= 0) && cnt; i--) {
      s -= oo[i];
      cnt--;
    }
    ans = min(ans, s * hh);
  }
  cout << ans;
}
