// 2011/10/02 Tazoe

#include <iostream>
using namespace std;

int main()
{
	int n;
	cin >> n;

	int C[100][2];
	for(int i=0; i<n; i++)
		cin >> C[i][0] >> C[i][1];

	int sum = 0;
	while(n>1){
		int max = C[0][1]*C[1][0];
		int I = 0;
		for(int i=1; i<n-1; i++)
			if(max<C[i][1]*C[i+1][0]){
				max = C[i][1]*C[i+1][0];
				I = i;
			}

		sum += C[I][0]*C[I][1]*C[I+1][0]*C[I+1][1];
		C[I][1] = C[I+1][1];
		for(int i=I+1; i<n-1; i++){
			C[i][0] = C[i+1][0];
			C[i][1] = C[i+1][1];
		}
		n--;
	}

	cout << sum << endl;

	return 0;
}