#include <bits/stdc++.h>
using namespace std;
int x[1010][2], y[1010];
vector<pair<int, int> > s;
int main() {
  int n, m, ans = (1010 * 1010 * 1010);
  scanf("%d", &n);
  m = n >> 1;
  for (int i = (0); i < (n); i++) scanf("%d %d", &x[i][0], &x[i][1]);
  for (int h = (1); h < (1010); h++) {
    int f = 1, rot = 0, mh = 0, w = 0, mi = -1;
    for (int i = (0); i < (n); i++) {
      if (x[i][1] > h && x[i][0] > h) {
        f = 0;
        break;
      } else if (x[i][1] > h) {
        y[i] = 1;
        rot++;
        mh |= (x[i][0] == h);
      } else if (x[i][1] == h) {
        mh = 1;
        continue;
      } else if (x[i][0] > h)
        continue;
      else if (x[i][0] > x[i][1]) {
        if (x[i][0] == h) {
          if (mi == -1)
            mi = i;
          else if (x[i][1] < x[mi][1])
            mi = i;
        }
        s.push_back(make_pair(x[i][1] - x[i][0], i));
      }
    }
    if (f && !mh && mi >= 0) {
      y[mi] = 1;
      rot++;
      mh = 1;
    }
    if (mh && f && rot <= m) {
      sort((s).begin(), (s).end());
      int l = (int)s.size();
      for (int i = (0); i < (l); i++) {
        if (rot < m && !y[s[i].second]) {
          y[s[i].second] = 1;
          rot++;
        }
      }
      for (int i = (0); i < (n); i++) {
        if (!y[i]) {
          w += x[i][0];
        } else {
          w += x[i][1];
        }
      }
      ans = min(ans, h * w);
    }
    memset(y, 0, sizeof(y));
    s.clear();
  }
  printf("%d\n", ans);
  return 0;
}
