#include <bits/stdc++.h>
using namespace std;
int n, a, b, tim, maxh, h[1005], w[1005], ty;
long long ans, minl = 100000000000LL;
priority_queue<pair<int, int> > q;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &w[i], &h[i]);
  }
  for (int j = 1; j <= 2 * n; j++) {
    priority_queue<pair<int, int> > qu;
    ans = 0;
    tim = 0;
    bool flag = false;
    if (j % 2 == 0) {
      ty = j / 2;
      maxh = w[j / 2];
      tim = 1;
      ans += (long long)w[j / 2] * h[j / 2];
    } else {
      ty = j / 2 + 1;
      maxh = h[ty];
      ans += (long long)w[ty] * h[ty];
    }
    for (int i = 1; i <= n; i++) {
      if (i == ty) continue;
      if (w[i] > maxh && h[i] > maxh) {
        flag = true;
        break;
      }
      if (w[i] > maxh || h[i] > maxh) {
        if (w[i] < h[i]) {
          tim++;
          ans += (long long)h[i] * maxh;
          if (tim > n / 2) {
            flag = true;
            break;
          }
        } else
          ans += (long long)w[i] * maxh;
      } else {
        qu.push(make_pair(w[i] - h[i], w[i]));
      }
    }
    if (flag == true) continue;
    while (!qu.empty() && tim < n / 2 && qu.top().first > 0) {
      tim++;
      ans += (long long)(qu.top().second - qu.top().first) * maxh;
      qu.pop();
    }
    while (!qu.empty()) {
      ans += (long long)(qu.top().second) * maxh;
      qu.pop();
    }
    minl = min(minl, ans);
  }
  printf("%lld", minl);
}
