#include <bits/stdc++.h>
using namespace std;
const int INF = (int)2e9;
const long long INFL = (long long)9e18;
const int MAXINT = ((~0) ^ (1 << 31));
const long long MAXLL = ((~0) ^ ((long long)1 << 63));
template <class T>
inline T pow2(T a) {
  return a * a;
}
template <class T>
inline bool mineq(T& a, T b) {
  return (a > b) ? (a = b, true) : false;
}
template <class T>
inline bool maxeq(T& a, T b) {
  return (a < b) ? (a = b, true) : false;
}
const int maxn = (int)1111;
;
int n;
struct human {
  int h, w;
  void input() { cin >> w >> h; }
  bool operator<(const human& a) const { return h - w < a.h - a.w; }
} num[maxn];
bool used[maxn];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < (int)(n); i++) num[i].input();
  sort(num, num + n);
  long long ans = INF;
  for (int maxh = 1; maxh < (int)(maxn); maxh++) {
    fill(used, used + n, false);
    long long cnt = 0, width = 0, f = 1;
    for (int i = 0; i < (int)(n); i++) {
      if (num[i].h > maxh && num[i].w > maxh) f = false;
      if (num[i].h > maxh) {
        used[i] = true;
        cnt++;
      }
    }
    for (int i = 0; i < (int)(n); i++) {
      if (!used[i] && cnt + 1 <= n / 2 && num[i].h < num[i].w &&
          num[i].w <= maxh) {
        used[i] = true;
        cnt++;
      }
      if (used[i])
        width += num[i].h;
      else
        width += num[i].w;
    }
    if (f && cnt <= n / 2) mineq(ans, maxh * width);
  }
  cout << ans;
}
