#include <bits/stdc++.h>
using namespace std;
int n;
int w[1111], h[1111];
int ans = 1000000000;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d%d", w + i, h + i);
  for (int x = 1; x <= 2 * n; ++x) {
    int lim = x <= n ? h[x] : w[x - n];
    vector<int> q;
    int wid = 0, cnt = 0;
    bool flag = 1;
    for (int i = 1; i <= n; ++i) {
      if (h[i] > lim && w[i] > lim) {
        flag = 0;
      } else if (h[i] > lim) {
        ++cnt;
        wid += h[i];
      } else if (w[i] > lim) {
        wid += w[i];
      } else
        q.push_back(h[i] - w[i]), wid += w[i];
    }
    if (cnt > n / 2) continue;
    if (!flag) continue;
    sort(q.begin(), q.end());
    for (int i = 0; i < q.size() && cnt < n / 2 && q[i] < 0; ++i)
      wid += q[i], ++cnt;
    ans = min(ans, lim * wid);
  }
  printf("%d\n", ans);
  return 0;
}
