#include <iostream>
#include <vector>

using namespace std;
typedef pair<int, int> P;
static const int INF = 99999999;

typedef pair<int,int> P;

unsigned int dp[101][101];

void solve()
{
	int n; 
	cin >> n;
	vector<P> v(n);
	for(int i = 0; i < n; ++i)
	{
		cin >> v[i].first >> v[i].second;
	}

	for(int i = 0; i <= n; ++i)
	{
		for(int j = 0; j <= n; ++j)
		{
			dp[i][j] = INF;
		}	
		dp[i][i] = 0;
	}
	for(int i = 1; i < n; ++i)//ツ閉敖づ個個按津ィ
	{
		for(int j = 0; j < n - i; ++j)//ツ開ツ始ツ暗環置ツづ個個按津ィ
		{
			for(int k = j; k < j + i; ++k)//ツ静伉断ツ暗環置ツづ個個按津ィ
			{
				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;
}

int main(void)
{
	solve();
	return(0);
}