#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e10;
const int inf = 1e9, dx[] = {0, 0, 1, -1, 1, -1, 1, -1},
          dy[] = {1, -1, 0, 0, 1, 1, -1, -1};
long long MOD = 1e9 + 7;
long double eps = 1e-7, pi = acos(-1);
int n;
pair<long long, long long> x[100100], y[100100], z[100100];
bool cmp1(pair<long long, long long> &x, pair<long long, long long> &y) {
  if (x.first > y.first) return 1;
  if (x.first < y.first) return 0;
  if (x.second < y.second) return 1;
  if (x.second > y.second) return 0;
  return 0;
}
bool cmp2(pair<long long, long long> &x, pair<long long, long long> &y) {
  if (x.second < y.second) return 1;
  if (x.second > y.second) return 0;
  if (x.first > y.first) return 1;
  if (x.first < y.first) return 0;
  return 0;
}
bool cmp3(pair<long long, long long> &x, pair<long long, long long> &y) {
  long long A =
      x.first * 1 + x.second * (n - 0) + y.first * 2 + y.second * (n - 1);
  long long B =
      x.first * 2 + x.second * (n - 1) + y.first * 1 + y.second * (n - 0);
  if (A < B) return 1;
  return 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x[i].first >> x[i].second;
    y[i] = {x[i].first, x[i].second};
    z[i] = {x[i].first, x[i].second};
  }
  sort(x, x + n, cmp3);
  sort(y, y + n, cmp2);
  sort(z, z + n, cmp3);
  long long ans = 0;
  for (int i = 0; i < n; i++) ans += z[i].first * i + z[i].second * (n - i - 1);
  cout << ans;
  return 0;
}
