#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T bigmod(T p, T e, T M) {
  long long ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p) % M;
    p = (p * p) % M;
  }
  return (T)ret;
}
template <class T>
inline T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <class T>
inline T modinverse(T a, T M) {
  return bigmod(a, M - 2, M);
}
pair<int, int> pp[1001];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = (0); i < (n); ++i) cin >> pp[i].first >> pp[i].second;
  int res = 2000000000;
  for (int i = 1; i <= 1000; i++) {
    int fl = 0, cnt = 0;
    priority_queue<int> pq;
    int W = 0;
    for (int j = (0); j < (n); ++j) {
      if (pp[j].first > i && pp[j].second > i)
        fl = 1;
      else if (pp[j].second > i) {
        cnt++;
        W += pp[j].second;
      } else {
        W += pp[j].first;
        if (pp[j].first > i || pp[j].first <= pp[j].second) continue;
        pq.push(pp[j].first - pp[j].second);
      }
    }
    if (fl) continue;
    if (cnt * 2 > n) continue;
    cnt = (n / 2) - cnt;
    while (!pq.empty()) {
      cnt--;
      if (cnt < 0) break;
      W -= pq.top();
      pq.pop();
    }
    res = min(res, W * i);
  }
  cout << res << endl;
}
