#include <bits/stdc++.h>
using namespace std;
long long solve(long long h, vector<pair<long long, long long> > arr,
                long long n) {
  long long m = n / 2;
  for (int i = 0; i < n; i++) {
    if (arr[i].second > h) {
      swap(arr[i].first, arr[i].second);
      m--;
    }
    if (arr[i].second > h) return 2e9;
  }
  if (m < 0) return 2e9;
  vector<long long> best;
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    if (arr[i].second <= h && arr[i].first <= h) {
      if (arr[i].first > arr[i].second) {
        best.push_back(arr[i].first - arr[i].second);
      }
    }
    ans += arr[i].first;
  }
  sort(best.rbegin(), best.rend());
  for (int i = 0; i < min(m, (long long)best.size()); i++) {
    ans -= best[i];
  }
  return ans * h;
}
int main() {
  long long n;
  cin >> n;
  vector<pair<long long, long long> > arr;
  arr.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> arr[i].first >> arr[i].second;
  }
  long long ans = 2e9;
  for (int i = 1; i <= 1000; i++) {
    ans = min(solve(i, arr, n), ans);
  }
  cout << endl << ans;
  return 0;
}
