#include <bits/stdc++.h>
using namespace std;
int n;
int mas[1011][2];
int mark[1011];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &mas[i][0], &mas[i][1]);
  }
  int res = 1 << 30;
  for (int h = 1; h <= 1000; h++) {
    vector<int> must;
    vector<pair<int, int> > c;
    int W = 0;
    bool bad = 0;
    for (int i = 0; i < n; i++) {
      if (mas[i][1] > h && mas[i][0] > h) bad = 1;
      if (mas[i][1] > h) {
        must.push_back(i);
        W += mas[i][1];
      } else {
        W += mas[i][0];
        if (mas[i][0] <= h && mas[i][0] > mas[i][1])
          c.push_back(make_pair(mas[i][0] - mas[i][1], i));
      }
    }
    if (must.size() <= n / 2 && !bad) {
      sort(c.begin(), c.end(), greater<pair<int, int> >());
      int rest = n / 2 - must.size();
      for (int j = 0; j < min(rest, (int)c.size()); j++) {
        W -= c[j].first;
      }
      if (res > W * h) res = W * h;
    }
  }
  printf("%d\n", res);
}
