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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.precision(20);
#define inf 1000000007
#define INF 1000000000000000000LL
#define mod 1000000007
#define VI vector<int>
#define VPI vector < pair<int,int> >
#define PII pair<int, int>
#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define endl '\n'
#define REP(x, y) for(int x = 0; x < (y); ++x)
#define FOR(x, y, z) for(int x = y; x <= (z); ++x)
#define FORR(x, y, z) for(int x = y; x >= (z); --x)
using namespace std;
#define int long long
#define N 1000007

VPI g;
int n,przyrost,ilejest,pom,pomm,v,v1;
int ans[N];

#undef int
int main()
{
	#define int long long
	boost

	cin >> n;

	FOR(i,1,n)
	{
		cin >> przyrost >> ilejest;
		g.pb(mp(przyrost,ilejest));
	}

	sort(g.begin(),g.end());

	//cout << endl;

	//REP(i,g.size())
	//cout << g[i].st << " " << g[i].nd << endl;

	REP(i,g.size())
	{
		pom+=(g[i].nd+g[i].st*i);
	}

	ans[n]=pom;
	//cout << endl;

	FORR(i,n-1,1)
	{
		v=0;
		pom=INF;
		v1=0;

		FORR(j,g.size()-1,0)
		{
			//if (i==3) 
			//cout << v+g[j].nd+j*g[j].st << " ";

			if (pom>v+g[j].nd+j*g[j].st)
			{
				pom=v+g[j].nd+j*g[j].st;
				v1=j;
			}
			v+=g[j].st;

			//if (i==3)
			//cout << pom << " " << v << endl;
		}

		ans[i]=ans[i+1]-pom;
		g.erase(g.begin()+v1);
	}
	
	//cout << endl;

	FOR(i,1,n)
	cout << ans[i] << endl;

    
    return 0;
}