#include <bits/stdc++.h>
using namespace std;
int n, ans = 1e9;
pair<int, int> p[1005];
void solve(int height) {
  int width = 0, remain = n / 2;
  vector<int> priority;
  for (int i = 1; i <= n; i++)
    if (p[i].second > height)
      if (p[i].first > height)
        return;
      else if (remain) {
        remain--;
        width += p[i].second;
      } else
        return;
    else if (p[i].first > height)
      width += p[i].first;
    else if (p[i].first > p[i].second) {
      width += p[i].second;
      priority.push_back(p[i].first - p[i].second);
    } else
      width += p[i].first;
  sort(priority.rbegin(), priority.rend());
  for (int i = remain; i < priority.size(); i++) width += priority[i];
  ans = min(ans, width * height);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d %d", &p[i].first, &p[i].second);
  for (int i = 1; i <= 1000; i++) solve(i);
  printf("%d\n", ans);
  return 0;
}
