#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;

int main()
{
    int n;
    int a[128], b[128];

    scanf("%d", &n);
    for (int i = 0; i < n; i++) scanf("%d %d", a + i, b + i);

    int cost = 0;
    for (int i = 0; i < n - 1; i++){
        int a_min = min_element(a, a + n) - a;
        P ta = P(a[a_min], b[a_min]);
        a[a_min] = b[a_min] = INT_MAX;

        int b_min = min_element(b, b + n) - b;
        P tb = P(a[b_min], b[b_min]);
        a[b_min] = b[b_min] = INT_MAX;

        cost += ta.first * ta.second * tb.first * tb.second;
        a[a_min] = ta.first, b[a_min] = tb.second;
    }
    printf("%d\n", cost);

    return 0;
}