#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
int w[N], h[N];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d%d", &w[i], &h[i]);
  int ans = 0x7fffffff;
  for (int i = 1; i <= 1000; i++) {
    int cnt = 0;
    int sum = 0, tmp = 0;
    for (int j = 1; j <= n; j++)
      if (min(w[j], h[j]) > i) cnt = 1;
    if (cnt) continue;
    priority_queue<int> q;
    for (int j = 1; j <= n; j++)
      if (w[j] > i)
        sum += w[j];
      else if (h[j] > i)
        sum += h[j], cnt++;
      else
        tmp += w[j], q.push(w[j] - h[j]);
    for (int j = 0; j + cnt <= n / 2; j++) {
      ans = min(ans, i * (sum + tmp));
      if (q.empty()) break;
      tmp -= q.top();
      q.pop();
    }
  }
  cout << ans << endl;
  return 0;
}
