#include <bits/stdc++.h>
using namespace std;
const int MaxD = 1001;
vector<int> temp;
int main() {
  int n, w[MaxD] = {0}, h[MaxD] = {0}, maximum = 0, minimum = MaxD, ilgis;
  unsigned long long ats = 1e18;
  bool ar;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> w[i] >> h[i];
    if (max(w[i], h[i]) > maximum) maximum = max(w[i], h[i]);
    if (min(w[i], h[i]) < minimum) minimum = min(w[i], h[i]);
  }
  for (int i = minimum; i <= maximum; i++) {
    ilgis = 0;
    int vietos = n / 2;
    ar = true;
    temp.clear();
    for (int j = 1; j <= n; j++) {
      if (min(w[j], h[j]) > i) {
        ar = false;
        break;
      }
      if (h[j] > i && w[j] <= i) {
        vietos--;
        ilgis += h[j];
      } else if (w[j] > i && h[j] <= i) {
        ilgis += w[j];
      } else {
        ilgis += w[j];
        if (w[j] > h[j] && w[j] <= i) temp.push_back(h[j] - w[j]);
      }
      if (vietos < 0) {
        ar = false;
        break;
      }
    }
    sort(temp.begin(), temp.end());
    if (ar) {
      for (int j = 0; j < temp.size() && vietos; j++) {
        ilgis += temp[j];
        vietos--;
      }
    }
    if (ar && (ilgis * i) < ats) ats = ilgis * i;
  }
  cout << ats;
  return 0;
}
