#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T bigmod(T p, T e, T M) {
  long long int ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p) % M;
    p = (p * p) % M;
  }
  return (T)ret;
}
template <class T>
inline T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <class T>
inline T modinverse(T a, T M) {
  return bigmod(a, M - 2, M);
}
template <class T>
inline T bpow(T p, T e) {
  long long int ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p);
    p = (p * p);
  }
  return (T)ret;
}
int toInt(string s) {
  int sm;
  stringstream ss(s);
  ss >> sm;
  return sm;
}
int toLlint(string s) {
  long long int sm;
  stringstream ss(s);
  ss >> sm;
  return sm;
}
struct D {
  int h, w;
};
int n;
D a[1005];
int main() {
  int t, i, j, k, sm, mx;
  long long int rs = (LLONG_MAX / 10LL);
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d%d", &a[i].w, &a[i].h);
  }
  for (i = 1; i < 1001; i++) {
    mx = i;
    priority_queue<int> q;
    int w = 0, x = 0;
    for (j = 0; j < n; j++) {
      if (a[j].w > mx && a[j].h > mx) {
        break;
      }
      if (a[j].h > mx) {
        x++;
        w += a[j].h;
      } else {
        w += a[j].w;
        if (a[j].w <= a[j].h || a[j].w > mx) continue;
        q.push(a[j].w - a[j].h);
      }
    }
    if (j < n) continue;
    x = n / 2 - x;
    if (x < 0) continue;
    while (!q.empty()) {
      x--;
      if (x < 0) break;
      w -= q.top();
      q.pop();
    }
    rs = min(rs, (long long int)mx * (long long int)w);
  }
  printf("%lld\n", rs);
  return 0;
}
