#include <bits/stdc++.h>
using namespace std;
struct rec {
  int x, y;
} d[1010];
int n, t[3030];
bool cmp(rec a, rec b) { return (a.x - a.y) > (b.x - b.y); }
int main() {
  while (~scanf("%d", &n)) {
    int p = 0, x, y;
    for (int i = 1; i <= n; i++) {
      scanf("%d%d", &d[i].x, &d[i].y);
      t[++p] = d[i].x;
      t[++p] = d[i].y;
    }
    std::sort(1 + d, 1 + d + n, cmp);
    int flag, left, ans = 0x7fffffff;
    for (int i = 1; i <= 2 * n; i++) {
      y = t[i];
      x = 0;
      flag = 1, left = n / 2;
      for (int j = 1; j <= n; j++) {
        if (d[j].x > y && d[j].y > y) {
          flag = 0;
          break;
        }
        if (max(d[j].x, d[j].y) > y) {
          if (d[j].x > y) {
            x += d[j].x;
          } else {
            left--;
            x += d[j].y;
          }
        }
      }
      if (flag && left >= 0) {
        for (int j = 1; j <= n; j++) {
          if (d[j].x <= y && d[j].y <= y) {
            if (left <= 0) {
              x += d[j].x;
              continue;
            }
            if (d[j].x <= d[j].y) {
              x += d[j].x;
            } else {
              left--;
              x += d[j].y;
            }
          }
        }
        ans = min(ans, x * y);
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
