#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1005, MAXC = 1000000;
unordered_set<int> se;
int w[MAXN], h[MAXN], f[MAXN][MAXN];
int n, m;
int getMinWidth(int H) {
  for (int i = 1; i <= n; i++)
    if (h[i] > H && w[i] > H) return -1;
  memset(f, -1, sizeof f);
  if (h[1] <= H) f[1][0] = w[1];
  if (w[1] <= H && m >= 1) f[1][1] = h[1];
  for (int i = 2; i <= n; i++) {
    for (int j = 0; j <= m; j++) {
      if (h[i] <= H && f[i - 1][j] != -1) {
        if (f[i][j] == -1)
          f[i][j] = f[i - 1][j] + w[i];
        else
          f[i][j] = min(f[i][j], f[i - 1][j] + w[i]);
      }
      if (j > 0) {
        if (w[i] <= H && f[i - 1][j - 1] != -1) {
          if (f[i][j] == -1)
            f[i][j] = f[i - 1][j - 1] + h[i];
          else
            f[i][j] = min(f[i][j], f[i - 1][j - 1] + h[i]);
        }
      }
    }
  }
  int res = -1;
  for (int i = 0; i <= m; i++)
    if (f[n][i] != -1) {
      if (res == -1)
        res = f[n][i];
      else
        res = min(res, f[n][i]);
    }
  return res;
}
int solve() {
  int res = 2e9;
  for (unordered_set<int>::iterator it = se.begin(); it != se.end(); it++) {
    int H = *it;
    int minW = getMinWidth(H);
    if (minW == -1) continue;
    res = min(res, H * minW);
  }
  return res;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  m = n / 2;
  for (int i = 1; i <= n; i++)
    cin >> w[i] >> h[i], se.insert(w[i]), se.insert(h[i]);
  cout << solve() << endl;
  return 0;
}
