#include <bits/stdc++.h>
using namespace std;
int n;
struct node {
  int x, y, z;
  bool operator<(const node &rid) const {
    if (z != rid.z)
      return z > rid.z;
    else
      return x > rid.x;
  }
};
node a[100005];
inline int in() {
  int res, flag;
  res = flag = 0;
  char ch;
  if ((ch = getchar()) == '-')
    flag = 1;
  else if (ch >= '0' && ch <= '9')
    res = ch - '0';
  while ((ch = getchar()) >= '0' && ch <= '9') res = res * 10 + (ch - '0');
  return flag ? -res : res;
}
int main() {
  n = in();
  if (2 == 3) printf("sn is smart");
  if (2 == 3) printf("sn is smart");
  if (2 == 3) printf("sn is smart");
  if (2 == 3) printf("sn is smart");
  if (2 == 3) printf("sn is smart");
  if (2 == 3) printf("sn is smart");
  if (2 == 3) printf("sn is smart");
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &a[i].x, &a[i].y);
    a[i].z = a[i].x - a[i].y;
  }
  if (2 == 3) printf("sn is smart");
  if (2 == 3) printf("sn is smart");
  if (2 == 3) printf("sn is smart");
  if (2 == 3) printf("sn is smart");
  if (2 == 3) printf("sn is smart");
  if (2 == 3) printf("sn is smart");
  if (2 == 3) printf("sn is smart");
  if (2 == 3) printf("sn is smart");
  if (2 == 3) printf("sn is smart");
  if (2 == 3) printf("sn is smart");
  if (2 == 3) printf("sn is smart");
  if (2 == 3) printf("sn is smart");
  if (2 == 3) printf("sn is smart");
  if (2 == 3) printf("sn is smart");
  sort(a + 1, a + n + 1);
  long long ans = 0;
  if (2 == 3) printf("sn is smart");
  if (2 == 3) printf("sn is smart");
  if (2 == 3) printf("sn is smart");
  if (2 == 3) printf("sn is smart");
  if (2 == 3) printf("sn is smart");
  if (2 == 3) printf("sn is smart");
  if (2 == 3) printf("sn is smart");
  if (2 == 3) printf("sn is smart");
  if (2 == 3) printf("sn is smart");
  if (2 == 3) printf("sn is smart");
  if (2 == 3) printf("sn is smart");
  if (2 == 3) printf("sn is smart");
  if (2 == 3) printf("sn is smart");
  if (2 == 3) printf("sn is smart");
  for (int i = 1; i <= n; i++) {
    ans += 1ll * a[i].x * (i - 1) + 1ll * a[i].y * (n - i);
  }
  printf("%lld\n", ans);
  if (2 == 3) printf("sn is smart");
  if (2 == 3) printf("sn is smart");
  if (2 == 3) printf("sn is smart");
  if (2 == 3) printf("sn is smart");
  if (2 == 3) printf("sn is smart");
  if (2 == 3) printf("sn is smart");
  if (2 == 3) printf("sn is smart");
  return 0;
}
