#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
using namespace std;
template <class T>
T gcd(T a, T b) {
  return ((b == 0) ? a : gcd(b, a % b));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<pair<long long, long long>> p(n);
  for (int i = 0; i < (int)(n); i++) cin >> p[i].first >> p[i].second;
  long long ans = 1e18;
  for (int i = 0; i < (int)(n); i++) {
    long long h = p[i].first, tot = p[i].second;
    int num = (n / 2) - 1;
    int f = 1;
    vector<int> vis(n, 0);
    vis[i] = 1;
    for (int j = 0; j < (int)(n); j++)
      if (j != i) {
        if (p[j].second > h) {
          if (p[j].first > h) {
            f = 0;
            break;
          } else if (num) {
            tot += p[j].second;
            vis[j] = 1;
            num--;
          } else {
            f = 0;
            break;
          }
        }
      }
    vector<pair<long long, int>> pos;
    for (int j = 0; j < (int)(n); j++)
      if (!vis[j]) {
        if (p[j].second < p[j].first && p[j].first <= h) {
          pos.push_back(make_pair(p[j].first - p[j].second, j));
        } else
          tot += p[j].first, vis[j] = 1;
      }
    sort(pos.begin(), pos.end());
    reverse(pos.begin(), pos.end());
    for (int j = 0; j < (int)(pos.size()); j++) {
      if (num) {
        tot += p[pos[j].second].second;
        num--;
      } else
        tot += p[pos[j].second].first;
    }
    if (f) ans = min(ans, h * tot);
  }
  for (int i = 0; i < (int)(n); i++) {
    long long h = p[i].second, tot = p[i].first;
    int num = n / 2;
    int f = 1;
    vector<int> vis(n, 0);
    vis[i] = 1;
    for (int j = 0; j < (int)(n); j++)
      if (j != i) {
        if (p[j].second > h) {
          if (p[j].first > h) {
            f = 0;
            break;
          } else if (num) {
            tot += p[j].second;
            vis[j] = 1;
            num--;
          } else {
            f = 0;
            break;
          }
        }
      }
    vector<pair<long long, int>> pos;
    for (int j = 0; j < (int)(n); j++)
      if (!vis[j]) {
        if (p[j].second < p[j].first && p[j].first <= h) {
          pos.push_back(make_pair(p[j].first - p[j].second, j));
        } else
          tot += p[j].first, vis[j] = 1;
      }
    sort(pos.begin(), pos.end());
    reverse(pos.begin(), pos.end());
    for (int j = 0; j < (int)(pos.size()); j++) {
      if (num) {
        tot += p[pos[j].second].second;
        num--;
      } else
        tot += p[pos[j].second].first;
    }
    if (f) ans = min(ans, h * tot);
  }
  cout << ans << endl;
  return 0;
}
