#include <bits/stdc++.h>
using namespace std;
int n, m, x, y, z, k, w, tmp, cnt, ans;
struct node {
  int x, y;
  bool operator<(node const& T) const { return T.y - T.x > y - x; }
} A[1005], B[1005];
int main() {
  scanf("%d", &n);
  for (int i = (0); i < (n); i++) {
    scanf("%d %d", &A[i].x, &A[i].y);
    x = max(A[i].y, x);
    x = max(A[i].x, x);
  }
  sort(A, A + n);
  ans = 1000000002;
  for (int i = (1); i <= (x); i++) {
    w = 1;
    k = 0;
    tmp = 0;
    cnt = 0;
    for (int j = (0); j < (n); j++) {
      if (A[j].y <= i && A[j].x > i)
        tmp += A[j].x;
      else if (A[j].y <= i && A[j].x <= i)
        B[k++] = A[j];
      else if (A[j].y > i && A[j].x > i)
        w = 0;
      else if (A[j].y > i && A[j].x <= i) {
        tmp += A[j].y;
        cnt++;
      }
    }
    if (w == 0 || cnt > n / 2) continue;
    for (int j = (0); j < (k); j++) {
      if (cnt + 1 <= n / 2 && B[j].y < B[j].x) {
        cnt++;
        tmp += B[j].y;
      } else
        tmp += B[j].x;
    }
    ans = min(ans, tmp * i);
  }
  printf("%d\n", ans);
  return 0;
}
