#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1000LL + 10LL, inf = 1000000000LL;
long long n, w[maxn], h[maxn];
long long ans = inf, maxh;
bool mark[maxn];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> w[i] >> h[i];
    maxh = max(maxh, h[i]);
    maxh = max(maxh, w[i]);
  }
  for (int i = maxh; i >= 1; i--) {
    vector<long long> v;
    long long sum = 0;
    memset(mark, 0, sizeof(mark));
    int cnt = 0;
    for (int j = 1; j <= n; j++) {
      if (h[j] > i) {
        if (w[j] > i) goto abc;
        mark[j] = 1;
        cnt++;
      }
    }
    if (cnt > n / 2) goto abc;
    for (int j = 1; j <= n; j++) {
      if (mark[j] == 1)
        sum += h[j];
      else {
        if (w[j] <= i) v.push_back(w[j] - h[j]);
        sum += w[j];
      }
    }
    sort(v.begin(), v.end());
    for (int j = v.size() - 1; j >= 0; j--) {
      if (v[j] < 0) break;
      sum -= v[j];
      cnt++;
      if (cnt > n / 2) {
        sum += v[j];
        break;
      }
    }
    ans = min(ans, sum * i);
  abc:;
  }
  cout << ans << endl;
  return 0;
}
