#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lb = 1000;
void vrikodara(long long n = 12) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << setprecision(n) << fixed;
}
long long n, m;
vector<pair<long long, long long>> v;
bool possible(long long k) {
  long long cnt = 0;
  for (auto i : v) {
    if (i.second > k) {
      if (i.first > k) return false;
      cnt++;
    }
  }
  return cnt <= m;
}
bool cmp(const pair<long long, long long> &p1,
         const pair<long long, long long> &p2) {
  return (p1.first - p1.second > p2.first - p2.second);
}
long long fun(long long mx) {
  vector<pair<long long, long long>> p;
  long long w = 0, h = mx, cnt = 0;
  for (auto i : v) {
    if (i.second > mx) {
      cnt++;
      w += i.second;
    } else if (i.first > mx || i.first <= i.second)
      w += i.first;
    else
      p.push_back(i);
  }
  sort(p.begin(), p.end(), cmp);
  for (auto i : p) {
    if (cnt >= m)
      w += i.first;
    else {
      cnt++;
      w += i.second;
    }
  }
  w *= h;
  return w;
}
void solve() {
  cin >> n;
  v.resize(n);
  for (long long i = 0; i < n; i++) {
    cin >> v[i].first >> v[i].second;
  }
  m = n / 2;
  long long ans = 1e15;
  for (long long i = 1; i <= 1000; i++) {
    if (possible(i)) {
      ans = min(ans, fun(i));
    }
  }
  cout << ans;
}
int32_t main() {
  vrikodara();
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
