#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
int n;
long long a[1005][2];
long long mi = ((1ll << 62) - 1);
void calc(long long x) {
  int i;
  long long sum = 0;
  int cnt = 0;
  vector<pair<int, int> > v;
  for (i = 0; i < n; i++) {
    if (a[i][0] <= x && a[i][1] <= x) {
      if (a[i][0] <= a[i][1])
        sum += a[i][0];
      else
        v.push_back(pair<int, int>(a[i][1] - a[i][0], i));
    } else if (a[i][0] <= x)
      sum += a[i][1], cnt++;
    else if (a[i][1] <= x)
      sum += a[i][0];
    else
      return;
  }
  if (cnt > n / 2) return;
  sort(v.begin(), v.end());
  for (auto e : v) {
    if (cnt < n / 2)
      sum += a[e.second][1], cnt++;
    else
      sum += a[e.second][0];
  }
  mi = min(mi, x * sum);
}
int main() {
  int i, j, k;
  cin >> n;
  for (i = 0; i < n; i++)
    for (j = 0; j < 2; j++) cin >> a[i][j];
  for (i = 0; i < n; i++)
    for (j = 0; j < 2; j++) calc(a[i][j]);
  cout << mi;
  return 0;
}
