#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
typedef complex<double> P;
static const double EPS = 1e-8;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
int dfs(int sum,vector<PII> yama){
  if(yama.size()==1) return sum;
  int MAX=-1e8;
  int ret = 1e9;
  REP(i,yama.size()-1){
    MAX = max(yama[i+1].first+yama[i].second-yama[i].first-yama[i+1].second,MAX);
  }
  REP(i,yama.size()-1){
    if(yama[i+1].first+yama[i].second-yama[i].first-yama[i+1].second==MAX){
      vector<PII> tmp=yama;
      int a=yama[i].first,b=yama[i].second,c=yama[i+1].first,d=yama[i+1].second;
      tmp.erase(tmp.begin()+i);
      tmp.erase(tmp.begin()+i);
      tmp.insert(tmp.begin()+i,PII(a,d));
      ret = min(ret,dfs(sum+a*b*c*d,tmp));
    }
  }
  return ret;
}
int main(void){
  int n;
  cin>>n;
  vector<PII> yama(n);
  REP(i,n){
    int a,b;
    cin>>a>>b;
    yama[i] = PII(a,b);
  }
  cout<<dfs(0,yama)<<endl;
  return 0;
}