#include <bits/stdc++.h>
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)

typedef pair<int, int> pii;

int main() {
	int n;
	cin >> n;
	vector<pii> card(n);
	vector<bool> used(n, false);
	REP(i, n) {
		int a, b;
		scanf("%d %d", &a, &b);
		card[i] = pii(a, b);
	}
	
	int ans = 0;
	REP(i, n - 1) {
		vector<pair<int, pii> > v;
		REP(j, n - 1) if (!used[j]) {
			FOR(k, j + 1, n) if (!used[k]) {
				v.push_back(make_pair(card[j].first * card[k].second, pii(j, k)));
			}
		}
		sort(v.begin(), v.end());
		int p1 = v[0].second.first, p2 = v[0].second.second;
		ans += card[p1].first * card[p1].second * card[p2].first * card[p2].second;
		used[p2] = true;
		card[p1].second = card[p2].second;
	}
	cout << ans << endl;
	return 0;
}