using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;

namespace AtcoderCS
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            long[] X = new long[N], Y = new long[N], P = new long[N];

            for(long i = 0; i < N; i++)
            {
                var argXYP = Console.ReadLine().Split().Select(a => long.Parse(a)).ToArray();
                X[i] = argXYP[0];
                Y[i] = argXYP[1];
                P[i] = argXYP[2];
            }

            long[,] horizontalCache = new long[N, (1 << N)];
            long[,] verticalCache = new long[N, (1 << N)];


            for (int i = 0; i < (1L << N); i++)
            {
                List<long> horizontalLines = new List<long>();
                horizontalLines.Add(0);
                for(int j = 0; j < N; j++)
                {
                    if((i & (1 << j)) != 0)
                    {
                        horizontalLines.Add(Y[j]);
                    }
                }

                for(int j = 0; j < N; j++)
                {
                    long min = long.MaxValue;
                    foreach(var h in horizontalLines)
                    {
                        if(Math.Abs(h - Y[j]) * P[j] < min)
                        {
                            min = Math.Abs(h - Y[j]) * P[j];
                        }
                    }
                    if(Math.Abs(X[j]) * P[j] < min)
                    {
                        min = Math.Abs(X[j]) * P[j];
                    }
                    horizontalCache[j,i] = min;
                }


                List<long> verticalLines = new List<long>();
                verticalLines.Add(0);
                for (int j = 0; j < N; j++)
                {
                    if ((i & (1 << j)) != 0)
                    {
                        verticalLines.Add(X[j]);
                    }
                }

                for (int j = 0; j < N; j++)
                {
                    long min = long.MaxValue;
                    foreach (var v in verticalLines)
                    {
                        if (Math.Abs(v - X[j]) * P[j] < min)
                        {
                            min = Math.Abs(v - X[j]) * P[j];
                        }
                    }
                    if (Math.Abs(Y[j]) * P[j] < min)
                    {
                        min = Math.Abs(Y[j]) * P[j];
                    }
                    verticalCache[j, i] = min;
                }
            }

            long total0 = 0;
            for(int i = 0; i < N; i++)
            {
                total0 += horizontalCache[i,0];
            }
            Console.WriteLine(total0);

            int[] marks = new int[N];
            long[] costs = new long[N+1];
            for(int i = 0; i <= N; i++)
            {
                costs[i] = long.MaxValue;
            }

            while (true)
            {
                bool isFinish = false;
                for(int i = 0; i < N; i++)
                {
                    marks[i]++;
                    if(marks[i] == 3)
                    {
                        marks[i] = 0;
                        if(i == N - 1)
                        {
                            isFinish = true;
                        }
                    }
                    else
                    {
                        break;
                    }
                }
                if (isFinish)
                {
                    break;
                }

                int horizontal = 0;
                int bitCount = 0;
                for(int i = 0; i < N; i++)
                {
                    if(marks[i] == 1)
                    {
                        horizontal |= (1 << i);
                        bitCount++;
                    }
                }


                int vertical = 0;
                for (int i = 0; i < N; i++)
                {
                    if (marks[i] == 2)
                    {
                        vertical |= (1 << i);
                        bitCount++;
                    }
                }

                long total = 0;
                for(int i = 0; i < N; i++)
                {
                    total += Math.Min(horizontalCache[i,horizontal], verticalCache[i,vertical]);
                }

                if(costs[bitCount] > total)
                {
                    costs[bitCount] = total;
                }
            }

            for(int i = 1; i <= N; i++)
            {
                Console.WriteLine(costs[i]);
            }
        }
    }
}


Measured memory_bytes: 52328