#include <bits/stdc++.h>
using namespace std;
int w[1111], h[1111];
pair<int, int> arr[1111];
bool cmp(pair<int, int> u, pair<int, int> v) {
  return u.first - u.second > v.first - v.second;
}
int main() {
  int n;
  cin >> n;
  int mx = n / 2;
  int ans = 2000000000;
  for (int i = 0; i < n; i++) scanf("%d %d", w + i, h + i);
  for (int i = 0; i < n * 2; i++) {
    int H, s, cnt, nn = 0;
    if (i < n) {
      H = h[i];
      s = w[i];
      cnt = 0;
    } else {
      H = w[i - n];
      s = h[i - n];
      cnt = 1;
    }
    for (int j = 0; j < n; j++) {
      if (j == i || j == i - n) continue;
      if (h[j] > H) {
        cnt++, s += h[j];
        if (w[j] > H) cnt = mx + 1;
      } else if (w[j] > H)
        s += w[j];
      else if (w[j] > h[j])
        arr[nn++] = pair<int, int>(w[j], h[j]);
      else
        s += w[j];
      if (cnt > mx) break;
    }
    if (cnt > mx) continue;
    sort(arr, arr + nn, cmp);
    for (int j = 0; j < mx - cnt; j++) {
      s += arr[j].second;
    }
    for (int j = mx - cnt; j < nn; j++) s += arr[j].first;
    ans = min(ans, s * H);
  }
  cout << ans << endl;
  return 0;
}
