#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
 
using namespace std;
 
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define rep(i,n) REP(i,0,(n))
#define pb(n) push_back(n)
#define mp(n,m) make_pair(n, m)
#define all(r) r.begin(),r.end()
#define fi first
#define se second
#define println(X) cout<<X<<endl;
 
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1e9;

int calc(pii p1, pii p2){
	return p1.fi*p1.se*p2.fi*p2.se;
}

int main(){
	int n;
	cin>>n;
	vector<pii> v(n);
	rep(i, n) cin>>v[i].fi>>v[i].se;
	int ans = 0;
	while(v.size()>1){
		int idx1,idx2, m = INF;
		for(int i = 0; i < v.size()-1; i++){
			for(int j = i +1; j < v.size(); j++){
				if(calc(v[i], v[j]) < m){
					m = calc(v[i], v[j]);
					idx1 = i;
					idx2 = j;
				}
			}
		}
		pii p1 = v[idx1], p2 = v[idx2];
		ans += m;
		v.erase(v.begin()+idx2);
		v.erase(v.begin()+idx1);
		if(p1.fi*p2.se < p1.se*p2.fi){
			v.pb(pii(p1.fi,p2.se));
		}else{
			v.pb(pii(p2.fi,p1.se));
		}
	}println(ans);
}