#include <bits/stdc++.h>
using namespace std;
int const MAX_N = 5010;
int const MAX_Q = 410100;
int const MAX_CH = 410100;
long long const LL_INF = 1000000000000000009LL;
pair<int, int> s[MAX_N];
int nnew[MAX_N];
int used_list[1050];
int min_sum_for_max[2][510][1050];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d%d", &s[i].first, &s[i].second);
  sort(s, s + n);
  long long ans = 0;
  for (int j = 0; j < n; j++) ans += s[j].first;
  long long mx = 0;
  for (int j = 0; j < n; j++) mx = max(mx, 0LL + s[j].second);
  ans *= mx;
  for (int tk = 0; tk <= n / 2; tk++)
    for (int j = 0; j <= 1000; j++) {
      min_sum_for_max[0][tk][j] = 2000000000;
      min_sum_for_max[1][tk][j] = 2000000000;
    }
  min_sum_for_max[0][0][0] = 0;
  int AA = 0, BB = 1;
  int used_list_len = 1;
  used_list[0] = 0;
  for (int qq = 0; qq < n; qq++) {
    for (int r = 0; r < used_list_len; r++) {
      int index = used_list[r];
      for (int tk = 0; tk <= n / 2; tk++)
        min_sum_for_max[BB][tk][index] = 2000000000;
    }
    for (int tk = 0; tk <= n / 2; tk++)
      for (int r = 0; r < used_list_len; r++) {
        int j = used_list[r];
        int new_jj = max(j, s[qq].second);
        int &new_DP = min_sum_for_max[BB][tk][new_jj];
        new_DP = min(new_DP, min_sum_for_max[AA][tk][j] + s[qq].first);
        if (!nnew[new_jj]) {
          nnew[new_jj] = 1;
          used_list[used_list_len++] = new_jj;
        }
      }
    for (int tk = 0; tk <= n / 2; tk++)
      for (int r = 0; r < used_list_len; r++) {
        int j = used_list[r];
        int new_jj = max(j, s[qq].first);
        int &new_DP = min_sum_for_max[BB][tk + 1][new_jj];
        new_DP = min(new_DP, min_sum_for_max[AA][tk][j] + s[qq].second);
        if (!nnew[new_jj]) {
          nnew[new_jj] = 1;
          used_list[used_list_len++] = new_jj;
        }
      }
    swap(AA, BB);
  }
  for (int j = 0; j <= 1000; j++)
    for (int tk = 0; tk <= n / 2; tk++)
      if (min_sum_for_max[AA][tk][j] < 2000000000 - 10)
        ans = min(ans, min_sum_for_max[AA][tk][j] * ((long long)j));
  cout << ans;
  return 0;
}
