#include <bits/stdc++.h>
using namespace std;
int n, w[1010], h[1010];
void read() {
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> w[i] >> h[i];
}
int calc(int x) {
  static int a[1010];
  int m = 0, s = 0, sum = 0;
  for (int i = 1; i <= n; ++i) {
    if (h[i] > x && w[i] > x) return 1000001;
    if (h[i] > x)
      ++s, sum += h[i];
    else if (w[i] <= x)
      a[++m] = h[i] - w[i], sum += w[i];
    else
      sum += w[i];
  }
  if (s > n / 2) return 1000001;
  sort(a + 1, a + m + 1);
  for (int i = 1; i <= n / 2 - s && i <= m; ++i)
    if (a[i] < 0) sum += a[i];
  return sum;
}
int work() {
  int ans = 1 << 30;
  for (int i = 1; i <= n; ++i) {
    int v1 = calc(h[i]), v2 = calc(w[i]);
    if (v1 <= 1000000) ans = min(ans, v1 * h[i]);
    if (v2 <= 1000000) ans = min(ans, v2 * w[i]);
  }
  return ans;
}
int main() {
  read();
  cout << work() << endl;
  return 0;
}
