#include <bits/stdc++.h>
using namespace std;
long long n;
long long w[1005], h[1005], width = 0;
long long ans = 1e18L + 5;
bool solve(long long height) {
  width = 0;
  long long l = n / 2;
  priority_queue<int> q;
  for (int i = int(0); i <= int(n - 1); i++) {
    if (h[i] > height) {
      if (w[i] <= height) {
        width += h[i];
        l--;
      } else
        return false;
    } else {
      width += w[i];
      if (w[i] <= height && w[i] > h[i]) q.push(w[i] - h[i]);
    }
    if (l < 0) return false;
  }
  while (l && !q.empty()) {
    width -= q.top();
    q.pop();
    l--;
  }
  return true;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> w[i] >> h[i];
  for (int i = int(1); i <= int(1000); i++) {
    if (solve(i)) ans = min(ans, width * i);
  }
  cout << ans;
}
