unittest
{
	assert( [ "3", "1 2 300", "3 3 600", "1 4 800" ].solve == "2900\n900\n0\n0" );
	assert( [ "5", "3 5 400", "5 3 700", "5 5 1000", "5 7 700", "7 5 400" ].solve == "13800\n1600\n0\n0\n0\n0" );
	assert( [ "6", "2 5 1000", "5 2 1100", "5 5 1700", "-2 -5 900", "-5 -2 600", "-5 -5 2200" ].solve == "26700\n13900\n3200\n1200\n0\n0\n0" );
	assert( [ "8", "2 2 286017", "3 1 262355", "2 -2 213815", "1 -3 224435", "-2 -2 136860", "-3 -1 239338", "-2 2 217647", "-1 3 141903" ].solve == "2576709\n1569381\n868031\n605676\n366338\n141903\n0\n0\n0" );
}



import std.algorithm;
import std.conv;
import std.math;
import std.range;
import std.stdio;

void main()
{
	stdin.byLineCopy.solve.writeln;
}

auto solve( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.to!( long );
	auto xyps = new long[ 3 ][ n ];
	foreach( ref xyp; xyps )
	{
		input.popFront;
		xyp = input.front.split.to!( long[] );
	}
	
	auto anss = new long[ n + 1 ];
	anss[] = long.max;
	auto ds = new long[ n ];
	auto s = 0L;
	foreach( ref d, xyp; lockstep( ds, xyps ) )
	{
		d = min( xyp[ 0 ].abs, xyp[ 1 ].abs ) * xyp[ 2 ];
		s += d;
	}
	solve2( anss, xyps, 0, 0, s, ds );
	
	return anss.to!( string[] ).join( "\n" );
}

void solve2( ref long[] anss, long[ 3 ][] xyps, long c, long i, long s, long[] ds )
{
	if( xyps.length <= i || c + 1 == anss.length )
	{
		anss[ c ] = min( anss[ c ], s );
		return;
	}
	
	// i番目の集落に南北の鉄道を引くとき
	{
		auto ss = s;
		auto dds = new long[ ds.length ];
		foreach( ref dd, d, xyp; lockstep( dds, ds, xyps ) )
		{
			dd = min( d, abs( xyps[ i ][ 0 ] - xyp[ 0 ] ) * xyp[ 2 ] );
			ss -= d - dd;
		}
		solve2( anss, xyps, c + 1, i + 1, ss, dds );
	}
	
	// i番目の集落に東西の鉄道を引くとき
	{
		auto ss = s;
		auto dds = new long[ ds.length ];
		foreach( ref dd, d, xyp; lockstep( dds, ds, xyps ) )
		{
			dd = min( d, abs( xyps[ i ][ 1 ] - xyp[ 1 ] ) * xyp[ 2 ] );
			ss -= d - dd;
		}
		solve2( anss, xyps, c + 1, i + 1, ss, dds );
	}
	
	// i番目の集落に鉄道を引かないとき
	solve2( anss, xyps, c, i + 1, s, ds );
}
