#include <bits/stdc++.h>
using namespace std;
const int maxn = 1010;
int w[maxn], h[maxn], vis[maxn], r[maxn];
int hh[2 * maxn];
bool cmp(const int &a, const int &b) { return h[a] - w[a] < h[b] - w[b]; }
int main() {
  int n;
  while (~scanf("%d", &n)) {
    int ans = 0x7fffffff;
    int W, H;
    for (int i = 0; i < n; i++) {
      scanf("%d%d", &w[i], &h[i]);
      hh[i << 1] = w[i];
      hh[i << 1 | 1] = h[i];
    }
    for (int i = 0; i < n; i++) r[i] = i;
    sort(r, r + n, cmp);
    for (int i = 0; i < 2 * n; i++) {
      int tmp = 0, flag = 1;
      H = hh[i];
      W = 0;
      memset(vis, 0, sizeof vis);
      for (int j = 0; j < n; j++)
        if (h[j] > H) {
          tmp++;
          vis[j] = 1;
          if (tmp > n / 2 || w[j] > H) {
            flag = 0;
            break;
          }
          W += h[j];
        }
      if (!flag) continue;
      for (int j = 0; j < n; j++) {
        int k = r[j];
        if (vis[k]) continue;
        if (w[k] > h[k] && w[k] <= H && tmp + 1 <= n / 2) {
          tmp++;
          W += h[k];
        } else {
          W += w[k];
        }
      }
      ans = min(ans, W * H);
    }
    cout << ans << endl;
  }
  return 0;
}
