func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long MOD = 1e9 + 7;   long long lgput(long long a, long long b, long long mod) {     long long ret = 1;     while (b) {       if (b & 1) ret = (ret * a) % mod;       a = (a * a) % mod;       b >>= 1;     }     return (ret % mod);   }   inline long long inv(long long x, long long MOD) {     return lgput(x, MOD - 2, MOD);   }   const long double PI = acos(-1);   const long double eps = 1e-6;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cout.precision(12);     cout.fixed;     int n;     cin >> n;     vector<int> a(n);     vector<int> b(n);     for (int i = 0; i < n; ++i) cin >> a[i] >> b[i];     vector<int> order(n);     for (int i = 0; i < n; ++i) order[i] = i;     sort(order.begin(), order.end(),          [&](int i, int j) -> bool { return a[i] + b[j] > a[j] + b[i]; });     long long ret = 0;     for (int i = 0; i < n; ++i) {       ret += 1ll * i * a[order[i]] + 1ll * (n - 1 - i) * b[order[i]];     }     cout << ret <<   n ;     return 0;   }   