#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,x[25],y[25],p[25],tot;
struct Line{
	bool f;//f=0:x=k f=1:y=k
	int k;
}l[25];
ll ans=0;
ll Calc(){
	ll r=0;
	for(int i=1;i<=n;i++){
		int minn=1e9;
		for(int j=1;j<=tot;j++){
			if(l[j].f)minn=min(minn,abs(l[j].k-y[i]));
			else minn=min(minn,abs(l[j].k-x[i]));
		}
		r+=1ll*minn*p[i];
		if(r>=ans)return r;
	}
	return r;
}
void dfs(int now,int nd){
	if(n-now+1<nd)return ;
	if(!nd)return ans=min(ans,Calc()),void();
	dfs(now+1,nd);
	l[++tot]={0,x[now]};
	dfs(now+1,nd-1);
	l[tot]={1,y[now]};
	dfs(now+1,nd-1);
	tot--;
}
int main() {
	//for(int i=1;i<=15;i++)cout<<rand()%15<<' '<<rand()%15<<' '<<rand()%15<<'\n';
	cin>>n;
	for(int i=1;i<=n;i++)cin>>x[i]>>y[i]>>p[i];
	for(int i=1;i<=n;i++)ans+=1ll*min(abs(x[i]),abs(y[i]))*p[i];
	cout<<ans<<endl;
	l[1]={0,0},l[1]={1,0};
	for(int i=1,F=0;i<=n;i++){
		tot=2;
		if(!F)dfs(1,i);
		cout<<ans<<endl;
		if(!ans)F=1;
	}
}