#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define mod 1000000007
typedef long long ll;
using namespace std;
int n;
vector<ll> v;
int main(){
  cin>>n;
  for(int i=0;i<2*n;i++){
    ll a;cin>>a;
    v.push_back(a);
  }
  ll ans=0;
  while(v.size()>2){
    ll maxi=0,cnt;
    vector<ll>::iterator it;
    for(int i=1;i<v.size()-2;i+=2){
      if(maxi<v[i]*v[i+1]){
	maxi=v[i]*v[i+1];
	cnt=v[i-1]*v[i]*v[i+1]*v[i+2];
	it=v.begin()+i;
      }
    }
    ans+=cnt;
    v.erase(it);
    v.erase(it);
  }
  cout<<ans<<endl;
  return 0;
}