#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

typedef pair<int,int> pii;
int const INF = 1<<30;

int main() {
  int n;
  cin >> n;
  vector<int> v1(n),v2(n);
  REP(i,n) {
    cin >> v1[i] >> v2[i];
  }
  int ans = 0;
  while(v1.size()>1) {
    pii t1(INF,0),t2,b1(INF,0),b2;
    REP(i,n) {
      if (t1>pii(v1[i],i)) {
        t2 = t1;
        t1 = pii(v1[i],i);
      } else {
        t2 = min(pii(v1[i],i),t2);
      }
      if (b1>pii(v2[i],i)) {
        b2 = b1;
        b1 = pii(v2[i],i);
      } else {
        b2 = min(pii(v2[i],i),b2);
      }
    }
    int ue,shita;
    if (t1.second == b1.second) {
      if (t2.first < b2.first) {
        ue = t2.second;
        shita = b1.second;
      } else {
        ue = t1.second;
        shita = b2.second;
      }
    } else {
      ue = t1.second;
      shita = b1.second;
    }
    // cout << ue << " " << shita<< endl;
    ans += v1[ue]*v2[ue]*v1[shita]*v2[shita];
    v1.push_back(v1[ue]);
    v2.push_back(v2[shita]);
    v1.erase(v1.begin()+ue);
    v1.erase(v1.begin()+shita);
    v2.erase(v2.begin()+ue);
    v2.erase(v2.begin()+shita);
  }
  cout << ans << endl;
}