#include <bits/stdc++.h>
using namespace std;
template <class T1>
void deb(T1 e) {
  cout << e << endl;
}
template <class T1, class T2>
void deb(T1 e1, T2 e2) {
  cout << e1 << " " << e2 << endl;
}
template <class T1, class T2, class T3>
void deb(T1 e1, T2 e2, T3 e3) {
  cout << e1 << " " << e2 << " " << e3 << endl;
}
template <class T1, class T2, class T3, class T4>
void deb(T1 e1, T2 e2, T3 e3, T4 e4) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << endl;
}
template <class T1, class T2, class T3, class T4, class T5>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << endl;
}
template <class T1, class T2, class T3, class T4, class T5, class T6>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5, T6 e6) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << " " << e6
       << endl;
}
vector<int> tmp;
int arr[1010][2];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  int i, ans, n, h, minih, maxih, k, cnt;
  ans = INT_MAX;
  minih = 0;
  maxih = 0;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> arr[i][0] >> arr[i][1];
    minih = max(minih, min(arr[i][0], arr[i][1]));
    maxih = max(maxih, max(arr[i][0], arr[i][1]));
  }
  int w;
  k = n / 2;
  for (h = minih; h <= maxih; h++) {
    cnt = w = 0;
    tmp.clear();
    for (i = 0; i < n; i++) {
      if (arr[i][1] > h) {
        cnt++;
        if (cnt > k) goto shesh;
        w += arr[i][1];
        continue;
      }
      w += arr[i][0];
      if (arr[i][0] <= h && arr[i][0] - arr[i][1] > 0)
        tmp.push_back(arr[i][0] - arr[i][1]);
    }
    sort(tmp.rbegin(), tmp.rend());
    for (i = 0; i < tmp.size() && cnt < k; i++) {
      cnt++;
      w -= tmp[i];
    }
    ans = min(ans, w * h);
  shesh:;
  }
  deb(ans);
  return 0;
}
