#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

struct DATA{
  int a;
  int b;
};

DATA MakeOneData(int, int);
int CalculateSum(vector<DATA>);
bool Compare1(const DATA&, const DATA&);
bool Compare2(const DATA&, const DATA&);

int main(){
  int i, n, a, b;
  vector<DATA> data;

  cin >> n;
  for(i=0; i<n; ++i){
    cin >> a >> b;
    data.push_back(MakeOneData(a, b));
  }
  cout << CalculateSum(data) << endl;
  return 0;
}

DATA MakeOneData(int a, int b){
  DATA data;
  data.a = a;
  data.b = b;
  return data;
}

int CalculateSum(vector<DATA> data){
  int sum = 0, a1, b1, a2, b2;

  while(1){
    sort(data.begin(), data.end(), Compare1);
    a1 = data[0].a;
    b1 = data[0].b;
    data.erase(data.begin());

    sort(data.begin(), data.end(), Compare2);
    a2 = data[0].a;
    b2 = data[0].b;
    data.erase(data.begin());

    sum += (a1 * b1 * a2 * b2);
    if(data.size() == 0) return sum;
    data.push_back(MakeOneData(a2, b1));
  }
}

bool Compare1(const DATA& x, const DATA& y){
  if(x.a == y.a) return x.b < y.b;
  else return x.a > y.a;
}

bool Compare2(const DATA& x, const DATA& y){
  if(x.b == y.b) return x.a < y.a;
  else return x.b > y.b;
}