#include <bits/stdc++.h>
using namespace std;
int n;
struct data {
  int w, h;
} a[1005];
priority_queue<int, vector<int>, greater<int> > q;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d%d", &a[i].w, &a[i].h);
  int ans = 1e9 + 5;
  for (int i = 1; i <= n; i++) {
    int m = a[i].h, now = a[i].w, cnt = 0;
    for (int j = 1; j <= n; j++) {
      if (j != i && a[j].h > m) cnt++;
      if (a[j].h > m && a[j].w > m) cnt = n + 5;
    }
    if (cnt <= n / 2) {
      for (int j = 1; j <= n; j++)
        if (j != i) {
          if (a[j].h > m)
            now += a[j].h;
          else {
            now += a[j].w;
            if (a[j].w <= m) q.push(a[j].h - a[j].w);
          }
        }
      while (cnt < n / 2 && !q.empty()) {
        int x = q.top();
        if (x >= 0) break;
        now += x;
        q.pop();
        cnt++;
      }
      while (!q.empty()) q.pop();
      ans = min(ans, m * now);
    }
    m = a[i].w, now = a[i].h, cnt = 1;
    for (int j = 1; j <= n; j++) {
      if (j != i && a[j].h > m) cnt++;
      if (a[j].h > m && a[j].w > m) cnt = n + 5;
    }
    if (cnt > n / 2) continue;
    for (int j = 1; j <= n; j++)
      if (j != i) {
        if (a[j].h > m)
          now += a[j].h;
        else {
          now += a[j].w;
          if (a[j].w <= m) q.push(a[j].h - a[j].w);
        }
      }
    while (cnt < n / 2 && !q.empty()) {
      int x = q.top();
      if (x >= 0) break;
      now += x;
      q.pop();
      cnt++;
    }
    while (!q.empty()) q.pop();
    ans = min(ans, m * now);
  }
  printf("%d\n", ans);
  return 0;
}
