#include <bits/stdc++.h>   using namespace std;   const double PI = acos(-1.0);   const double EPS = 1e-6;   int main() {     { ; };     int n;     scanf( %d , &n);     vector<pair<int, int> > V(n);     int totalW = 0;     for (int i = 0; i < n; i++) {       scanf( %d %d , &V[i].first, &V[i].second);       totalW += V[i].first;     }     int res = ((1 << 30) - 1);     for (int maxH = 1; maxH <= 1000; maxH++) {       bool testOK = true;       int coda = n / 2;       int nowW = totalW;       vector<int> candidate;       for (int i = 0; i < n && testOK; i++) {         if (V[i].second > maxH) {           if (V[i].first > maxH)             testOK = false;           else {             if (coda == 0)               testOK = false;             else               nowW += V[i].second - V[i].first;             coda--;           }         } else {           if (V[i].first > V[i].second && V[i].first <= maxH) {             candidate.emplace_back(V[i].second - V[i].first);           }         }       }       if (testOK) {         sort((candidate).begin(), (candidate).end());         nowW += accumulate(             candidate.begin(),             candidate.begin() + min(((int)(candidate).size()), coda), 0);         res = min(res, nowW * maxH);       }     }     printf( %d n , res);     return 0;   }   