#include <bits/stdc++.h>
using namespace std;
int dp[1005][505], newdp[1005][505];
int main() {
  memset(dp, 0x7f, sizeof(dp));
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    memset(newdp, 0x7f, sizeof(newdp));
    int w, h;
    cin >> w >> h;
    if (i == 0) {
      newdp[h][0] = w;
      newdp[w][1] = h;
    } else {
      for (int j = 0; j <= 1000; j++) {
        for (int k = 0; k <= (int)(n / 2); k++) {
          if (j >= h)
            newdp[j][k] = min(newdp[j][k], dp[j][k] + w);
          else
            newdp[h][k] = min(newdp[h][k], dp[j][k] + w);
          if (w <= j)
            newdp[j][k + 1] = min(newdp[j][k + 1], dp[j][k] + h);
          else
            newdp[w][k + 1] = min(newdp[w][k + 1], dp[j][k] + h);
        }
      }
    }
    memcpy(dp, newdp, sizeof(dp));
  }
  long long best = 1000000000000;
  for (int j = 0; j <= 1000; j++) {
    for (int k = 0; k <= (int)(n / 2); k++) {
      if (dp[j][k] <= 100000000)
        best = min((long long)best, (long long)(dp[j][k]) * j);
    }
  }
  cout << best << endl;
}
