#include <bits/stdc++.h>
using namespace std;
int a, b, r, t, i, k, j, n, m, maxh, minh, bres, tres;
int w[1123], h[1123], sorth[1123], sorthw[1123];
bool lay[1123];
bool cmp_sorth(int i, int j) { return (h[i] > h[j]); }
bool cmp_sorthw(int i, int j) { return (h[i] - w[i] < h[j] - w[j]); }
inline bool check(int il, int jl) {}
char conv(char c) { return ('9' - c + '0'); }
long long gcd(long long a, long long b) {
  if (b > a)
    return gcd(b, a);
  else if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
int getres(int MAXH) {
  int res = 0, sumw = 0, maxh = 0, a, b, i, j;
  i = 0;
  memset(lay, false, sizeof(lay));
  while (h[sorth[i]] > MAXH && i < n) {
    lay[sorth[i]] = true;
    res++;
    i++;
  }
  i = 0;
  while (res < n / 2 && i < n && w[sorthw[i]] > h[sorthw[i]]) {
    if (!(lay[sorthw[i]]) && (w[sorthw[i]] <= MAXH)) {
      lay[sorthw[i]] = true;
      res++;
    }
    i++;
  }
  for (i = 0; i < n; i++) {
    if (lay[i]) {
      sumw += h[i];
      maxh = max(maxh, w[i]);
    } else {
      sumw += w[i];
      maxh = max(maxh, h[i]);
    }
  }
  if (res > n / 2)
    return 1123456789;
  else
    return sumw * maxh;
}
int main() {
  if (0) {
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
  }
  cin >> n;
  maxh = 0;
  minh = 0;
  for (int i = 0; i < n; i++) {
    cin >> w[i] >> h[i];
    a = max(w[i], h[i]);
    b = min(w[i], h[i]);
    if (a > maxh) maxh = a;
    if (b > minh) minh = b;
    sorth[i] = i;
    sorthw[i] = i;
  }
  sort(sorth, sorth + n, cmp_sorth);
  sort(sorthw, sorthw + n, cmp_sorthw);
  bres = 1123456789;
  for (i = minh; i <= maxh; i++) {
    tres = getres(i);
    bres = min(bres, tres);
  }
  cout << bres;
  return 0;
}
