#include <bits/stdc++.h>
using namespace std;
template <typename S, typename T>
ostream& operator<<(ostream& out, pair<S, T> const& p) {
  out << '(' << p.first << ", " << p.second << ')';
  return out;
}
template <typename T>
ostream& operator<<(ostream& out, vector<T> const& v) {
  long long l = v.size();
  for (long long i = 0; i < l - 1; i++) out << v[i] << ' ';
  if (l > 0) out << v[l - 1];
  return out;
}
template <typename T>
void trace(const char* name, T&& arg1) {
  cout << name << " : " << arg1 << "\n";
}
template <typename T, typename... Args>
void trace(const char* names, T&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  trace(comma + 1, args...);
}
long double eps = 1e-9;
long long n;
vector<pair<long long, long long>> v;
void solve() {
  cin >> n;
  for (long long i = 0; i < n; i++) {
    long long w, h;
    cin >> w >> h;
    v.push_back({w, h});
  }
  long long ans = 1000000000000000001;
  for (long long i = 0; i < n; i++) {
    long long hei = v[i].second;
    long long total = 0;
    vector<pair<long long, long long>> temp;
    bool flag = 1;
    long long width = v[i].first;
    for (long long j = 0; j < n; j++) {
      if (j == i) continue;
      long long curr = j;
      if (min(v[curr].first, v[curr].second) > hei) {
        flag = 0;
        break;
      }
      if (v[curr].second > hei) {
        width += v[curr].second;
        total++;
      } else if (v[curr].first <= hei) {
        temp.push_back(v[curr]);
      } else {
        width += v[curr].first;
      }
    }
    if (flag == 0) continue;
    if (total > n / 2) {
      continue;
    }
    vector<long long> temp1;
    long long si = temp.size();
    for (long long j = 0; j < si; j++) {
      if (temp[j].first <= temp[j].second)
        width += temp[j].first;
      else {
        width += temp[j].first;
        temp1.push_back(temp[j].first - temp[j].second);
      }
    }
    sort(temp1.begin(), temp1.end());
    si = temp1.size();
    for (long long j = si - 1; j >= 0; j--) {
      if (total < n / 2) {
        width -= temp1[j];
        total++;
      }
    }
    ans = min(ans, width * hei);
  }
  for (long long i = 0; i < n; i++) {
    long long hei = v[i].first;
    long long total = 1;
    vector<pair<long long, long long>> temp;
    bool flag = 1;
    long long width = v[i].second;
    for (long long j = 0; j < n; j++) {
      if (j == i) continue;
      long long curr = j;
      if (min(v[curr].first, v[curr].second) > hei) {
        flag = 0;
        break;
      }
      if (v[curr].second > hei) {
        width += v[curr].second;
        total++;
      } else if (v[curr].first <= hei) {
        temp.push_back(v[curr]);
      } else {
        width += v[curr].first;
      }
    }
    if (flag == 0) continue;
    if (total > n / 2) {
      continue;
    }
    vector<long long> temp1;
    long long si = temp.size();
    for (long long j = 0; j < si; j++) {
      if (temp[j].first <= temp[j].second)
        width += temp[j].first;
      else {
        width += temp[j].first;
        temp1.push_back(temp[j].first - temp[j].second);
      }
    }
    sort(temp1.begin(), temp1.end());
    si = temp1.size();
    for (long long j = si - 1; j >= 0; j--) {
      if (total < n / 2) {
        width -= temp1[j];
        total++;
      }
    }
    ans = min(ans, width * hei);
  }
  cout << ans << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  t = 1;
  while (t--) solve();
}
