#include <bits/stdc++.h>
const int MOD = 1e9 + 7;
const int N = 1e3 + 15;
const int INF = (1 << 30) - 1;
const int letter = 130;
using namespace std;
int n;
struct node {
  int w, h, c;
} l[N], pt[N], c[N];
int vis[N];
bool cmp(node a, node b) { return a.c < b.c; }
int main() {
  while (scanf("%d", &n) != EOF) {
    int cs = 0;
    for (int i = 0; i < n; i++)
      scanf("%d%d", &l[i].w, &l[i].h), l[i].c = l[i].h - l[i].w;
    int min1 = INF;
    for (int vs = 1001; vs >= 0; vs--) {
      int flag = 0;
      int cnt = n / 2;
      memset(vis, 0, sizeof(vis));
      for (int i = 0; i < n; i++) pt[i] = l[i];
      for (int i = 0; i < n; i++) {
        if (pt[i].w > vs && pt[i].h > vs) {
          flag = -1;
          break;
        }
      }
      sort(pt, pt + n, cmp);
      if (flag == -1) break;
      for (int i = 0; i < n; i++) {
        if (pt[i].h > vs) {
          cnt--;
          vis[i] = 1;
          swap(pt[i].h, pt[i].w);
        }
      }
      if (cnt < 0) continue;
      for (int i = 0; i < n; i++) {
        if (vis[i]) continue;
        if (cnt <= 0) break;
        if (pt[i].h >= pt[i].w) continue;
        if (pt[i].w > vs) continue;
        swap(pt[i].h, pt[i].w);
        cnt--;
      }
      int sum = 0;
      for (int i = 0; i < n; i++) sum += pt[i].w;
      min1 = min(min1, vs * sum);
    }
    printf("%d\n", min1);
  }
  return 0;
}
