#include <iostream>
#include <vector>
#include <climits>
using namespace std;

#define REP(i,n,m) for(int i=n;i<m;i++)
#define rep(i,n) REP(i,0,n)
#define EREP(i,n,m) for(int i=n;i<=m;i++)
#define erep(i,n) EREP(i,0,n)

typedef pair<int,int> P;

unsigned int dp[101][101];

int main(void){
	int n; cin>>n;
	vector<P> v(n);
	rep(i,n) cin>>v[i].first>>v[i].second;

	erep(i,n){
		erep(j,n) dp[i][j] = INT_MAX;
		dp[i][i] = 0;
	}

	REP(i,1,n){
		REP(j,0,n-1){
			REP(k,j,j+i){
				int cost = v[j].first * v[k].second * v[k+1].first * v[j+i].second;
				dp[j][j+i] = min(dp[j][j+i],cost+dp[j][k]+dp[k+1][j+i]);
			}
		}
	}

	cout<<dp[0][n-1]<<endl;

	return 0;
}