1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <bits/stdc++.h>
using namespace std;

#define f first
#define s second

typedef long long int64;
typedef vector <int> VI;
typedef pair <int, int> PII;

const int mod = 1e9 + 7;
const int64 INF = 1000000000000000000LL;

const bool DEBUG = false;
#define DB if(DEBUG)

///////////////////////////////////////



int n;
int64 A[1000005];
int64 B[1000005];


int main() {
	ios_base::sync_with_stdio(0);
	scanf("%d", &n);
  for(int i = 0; i < n; i++)
    scanf("%lld %lld", &A[i], &B[i]);
  
  for(int i = 1; i <= n; i++) {
    vector <pair <int64, int64> > tab;
    for(int j = 0; j < n; j++) {
      tab.push_back({B[j], A[j]});
    }
    sort(tab.begin(), tab.end());
    int64 res = 0;
    int cnt = 0;
    for(int j = n - 1; j >= n - i; j--) {
      res += tab[j].first - (cnt++) * tab[j].second;
    }
    printf("%lld\n", res);
    for(int j = 0; j < n; j++) {
      B[j] += A[j];
    }
  }
	
	
	
	
	
	
}