using System;
using System.Linq;
using System.Collections.Generic;

namespace Contest
{
  class Program
  {
    static void Main(string[] args)
    {
      MSOLUTIONS2020.E();
    }

    class MSOLUTIONS2020
    {
      public static void A()
      {
        var X = Read.Int();
        Console.WriteLine((2199 - X) / 200);
      }
      public static void B()
      {
        var A = Read.Int();
        var B = Read.Int();
        var C = Read.Int();
        var K = Read.Int();
        int count = 0;
        while (B <= A)
        {
          B *= 2;
          count++;
        }
        while (C <= B)
        {
          C *= 2;
          count++;
        }
        Console.WriteLine(count <= K ? "Yes" : "No");
      }
      public static void C()
      {
        var N = Read.Int();
        var K = Read.Int();
        var A = Read.LongN();
        var sb = new System.Text.StringBuilder();
        for(int i = K; i < N; ++i)
        {
          sb.AppendLine(A[i - K] < A[i] ? "Yes" : "No");
        }
        Console.Write(sb.ToString());
      }
      public static void D()
      {
        var N = Read.Int();
        var A = Read.LongN();
        long money = 1000;
        long min = A[0];
        long max = A[0];
        for(int i = 1; i < N; ++i)
        {
          if(A[i] > max) { max = A[i]; }
          else
          {
            money += money / min * (max - min);
            max = A[i];
            min = A[i];
          }
        }
        money += money / min * (max - min);
        Console.WriteLine(money);
      }
      public static void E()
      {
        var N = Read.Int();
        var XYP = Enumerable.Range(0, N).Select(i => Read.LongN()).ToArray();
        var minCost = Enumerable.Range(0, N + 1).Select(i => (long)1e18).ToArray();

        long[,] XCost = new long[N, 1 << N];
        long[,] YCost = new long[N, 1 << N];
        for(int i = 0; i < (1 << N); ++i)
        {
          for(int j = 0; j < N; ++j)
          {
            var X = XYP[j][0];
            var Y = XYP[j][1];
            var P = XYP[j][2];
            {
              long minX = Math.Abs(X);
              long minY = Math.Abs(Y);
              for (int k = 0; k < N; ++k)
              {
                if ((i & (1 << k)) > 0)
                {
                  minX = Math.Min(minX, Math.Abs(X - XYP[k][0]));
                  minY = Math.Min(minY, Math.Abs(Y - XYP[k][1]));
                }
              }
              XCost[j, i] = minX * P;
              YCost[j, i] = minY * P;
            }
          }
        }
        E_DFS(N, 0, 0, 0, 0, XCost, YCost, minCost);
        Console.WriteLine(String.Join(Environment.NewLine, minCost));

        //long p3 = 1;
        //for(int i = 0; i < N; ++i) { p3 *= 3; }
        //for(int i = 0; i < p3; ++i)
        //{
        //  int xp = 0, yp = 0, c = N;
        //  int ii = i;
        //  for(int j = 0; j < N; ++j)
        //  {
        //    switch (ii % 3)
        //    {
        //      case 0: c--; break;
        //      case 1: xp += 1 << j; break;
        //      case 2: yp += 1 << j; break;
        //    }
        //    ii /= 3;
        //  }
        //  long cost = 0;
        //  for(int j = 0; j < N; ++j)
        //  {
        //    cost += Math.Min(XCost[j, xp], YCost[j, yp]);
        //  }
        //  minCost[c] = Math.Min(minCost[c], cost);
        //}
        //Console.WriteLine(String.Join(Environment.NewLine, minCost));
      }
      static void E_DFS(int N, int step, int c, int xp, int yp, long[,] XCost, long[,] YCost, long[] minCost)
      {
        if (N == step)
        {
          long cost = 0;
          for(int i = 0; i < N; ++i)
          {
            cost += Math.Min(XCost[i, xp], YCost[i, yp]);
          }
          minCost[c] = Math.Min(minCost[c], cost);
          return;
        }
        E_DFS(N, step + 1, c, xp, yp, XCost, YCost, minCost);
        E_DFS(N, step + 1, c + 1, xp + (1 << step), yp, XCost, YCost, minCost);
        E_DFS(N, step + 1, c + 1, xp, yp + (1 << step), XCost, YCost, minCost);
      }
      public static void F()
      {
        var N = Read.Int();
        var listU = new List<Tuple<int, int>>();
        var listD = new List<Tuple<int, int>>();
        var listL = new List<Tuple<int, int>>();
        var listR = new List<Tuple<int, int>>();
        for(int i = 0; i < N; ++i)
        {
          var X = Read.Int();
          var Y = Read.Int();
          var U = Read.Str();
          var t = new Tuple<int, int>(X, Y);
          if (U == "U") { listU.Add(t); }
          if (U == "D") { listD.Add(t); }
          if (U == "L") { listL.Add(t); }
          if (U == "R") { listR.Add(t); }
        }
        long min = (long)1e18;
        {
          var dictL = new Dictionary<int, List<int>>();
          var dictR = new Dictionary<int, List<int>>();
          foreach (var t in listL)
          {
            if (!dictL.ContainsKey(t.Item2)) { dictL.Add(t.Item2, new List<int>()); }
            dictL[t.Item2].Add(t.Item1);
          }
          foreach (var t in listR)
          {
            if (!dictR.ContainsKey(t.Item2)) { dictR.Add(t.Item2, new List<int>()); }
            dictR[t.Item2].Add(t.Item1);
          }
          min = Math.Min(min, F_LR(dictL, dictR));
        }
        {
          var dictL = new Dictionary<int, List<int>>();
          var dictR = new Dictionary<int, List<int>>();
          foreach (var t in listD)
          {
            if (!dictL.ContainsKey(t.Item1)) { dictL.Add(t.Item1, new List<int>()); }
            dictL[t.Item1].Add(t.Item2);
          }
          foreach (var t in listU)
          {
            if (!dictR.ContainsKey(t.Item1)) { dictR.Add(t.Item1, new List<int>()); }
            dictR[t.Item1].Add(t.Item2);
          }
          min = Math.Min(min, F_LR(dictL, dictR));
        }
        {
          var dict1 = new Dictionary<int, List<int>>();
          var dict2 = new Dictionary<int, List<int>>();
          foreach (var t in listR)
          {
            var key = t.Item2 - t.Item1;
            var value = t.Item1;
            var d = dict1;
            if (!d.ContainsKey(key)) { d.Add(key, new List<int>()); }
            d[key].Add(value);
          }
          foreach (var t in listD)
          {
            var key = t.Item2 - t.Item1;
            var value = t.Item1;
            var d = dict2;
            if (!d.ContainsKey(key)) { d.Add(key, new List<int>()); }
            d[key].Add(value);
          }
          min = Math.Min(min, F_RD(dict1, dict2));
        }
        {
          var dict1 = new Dictionary<int, List<int>>();
          var dict2 = new Dictionary<int, List<int>>();
          foreach (var t in listD)
          {
            var key = t.Item2 + t.Item1;
            var value = t.Item1;
            var d = dict1;
            if (!d.ContainsKey(key)) { d.Add(key, new List<int>()); }
            d[key].Add(value);
          }
          foreach (var t in listL)
          {
            var key = t.Item2 + t.Item1;
            var value = t.Item1;
            var d = dict2;
            if (!d.ContainsKey(key)) { d.Add(key, new List<int>()); }
            d[key].Add(value);
          }
          min = Math.Min(min, F_RD(dict1, dict2));
        }
        {
          var dict1 = new Dictionary<int, List<int>>();
          var dict2 = new Dictionary<int, List<int>>();
          foreach (var t in listL)
          {
            var key = t.Item2 - t.Item1;
            var value = -t.Item1;
            var d = dict1;
            if (!d.ContainsKey(key)) { d.Add(key, new List<int>()); }
            d[key].Add(value);
          }
          foreach (var t in listU)
          {
            var key = t.Item2 - t.Item1;
            var value = -t.Item1;
            var d = dict2;
            if (!d.ContainsKey(key)) { d.Add(key, new List<int>()); }
            d[key].Add(value);
          }
          min = Math.Min(min, F_RD(dict1, dict2));
        }
        {
          var dict1 = new Dictionary<int, List<int>>();
          var dict2 = new Dictionary<int, List<int>>();
          foreach (var t in listU)
          {
            var key = t.Item2 + t.Item1;
            var value = -t.Item1;
            var d = dict1;
            if (!d.ContainsKey(key)) { d.Add(key, new List<int>()); }
            d[key].Add(value);
          }
          foreach (var t in listR)
          {
            var key = t.Item2 + t.Item1;
            var value = -t.Item1;
            var d = dict2;
            if (!d.ContainsKey(key)) { d.Add(key, new List<int>()); }
            d[key].Add(value);
          }
          min = Math.Min(min, F_RD(dict1, dict2));
        }
        Console.WriteLine(min == (long)1e18 ? "SAFE" : min.ToString());
      }
      static long F_LR(Dictionary<int, List<int>> L, Dictionary<int, List<int>> R)
      {
        long min = (long)1e18;
        foreach(var kvp in L)
        {
          if (!R.ContainsKey(kvp.Key)){ continue; }
          var Ls = kvp.Value.OrderBy(x => x).ToArray();
          foreach(var v in R[kvp.Key])
          {
            var idx = Bound.Upperbound(Ls, v);
            if (idx < Ls.Length)
            {
              min = Math.Min(min, (Ls[idx] - v) * 5);
            }
          }
        }
        return min;
      }
      static long F_RD(Dictionary<int, List<int>> R, Dictionary<int, List<int>> D)
      {
        long min = (long)1e18;
        foreach (var kvp in R)
        {
          if (!D.ContainsKey(kvp.Key)) { continue; }
          var Ds = D[kvp.Key].OrderBy(x => x).ToArray();
          foreach (var v in kvp.Value)
          {
            var idx = Bound.Upperbound(Ds, v);
            if (idx < Ds.Length)
            {
              min = Math.Min(min, (Ds[idx] - v) * 10);
            }
          }
        }
        return min;
      }
    }






    class Util
    {
      public static T[,] Gen<T>(int r, int c, T v)
      {
        var matrix = new T[r, c];
        for (int i = 0; i < r; ++i)
        {
          for (int j = 0; j < c; ++j)
          {
            matrix[i, j] = v;
          }
        }
        return matrix;
      }
      public static long[] ASum(long[] array)
      {
        var res = new long[array.Length + 1];
        for (int i = 0; i < array.Length; ++i)
        {
          res[i + 1] = res[i] + array[i];
        }
        return res;
      }
      public static long[,] ASum(long[,] matrix)
      {
        var N = matrix.GetLength(0);
        var M = matrix.GetLength(1);
        var res = new long[N + 1, M + 1];
        for(int i = 0; i < N; ++i)
        {
          for(int j = 0; j < M; ++j)
          {
            res[i + 1, j + 1] = res[i, j + 1] + res[i + 1, j] - res[i, j] + matrix[i, j];
          }
        }
        return res;
      }
      public static MyDict<T, long> Frequency2<T>(T[] array)
      {
        var dict = new MyDict<T, long>();
        foreach (var a in array)
        {
          dict[a]++;
        }
        return dict;
      }
      public class MyDict<T1, T2> : Dictionary<T1, T2>
      {
        public new T2 this[T1 key]
        {
          get { if (!base.ContainsKey(key)) { base.Add(key, default(T2)); } return base[key]; }
          set { base[key] = value; }
        }
      }

      public static void WarshallFloyd(long[,] dist)
      {
        var N = dist.GetLength(0);
        for (int k = 0; k < N; ++k)
        {
          for (int i = 0; i < N; ++i)
          {
            for (int j = 0; j < N; ++j)
            {
              dist[i, j] = Math.Min(dist[i, j], dist[i, k] + dist[k, j]);
            }
          }
        }
      }
      public static long[,] DistFromAdj(int N, Dictionary<int, Dictionary<int, long>> adj)
      {
        var dist = new long[N, N];
        for (int i = 0; i < N; ++i)
        {
          for (int j = 0; j < N; ++j)
          {
            dist[i, j] = adj.ContainsKey(i + 1) && adj[i + 1].ContainsKey(j + 1) ? adj[i + 1][j + 1] : (long)1e18;
          }
        }
        return dist;
      }

    }
    class Bound
    {
      public static int Lowerbound<T1, T2>(SortedList<T1, T2> list, T1 x) where T1 : IComparable<T1>
      {
        return Lowerbound(list.Keys, x);
      }
      public static int Upperbound<T1, T2>(SortedList<T1, T2> list, T1 x) where T1 : IComparable<T1>
      {
        return Upperbound(list.Keys, x);
      }
      public static int Lowerbound<T>(IList<T> list, T x) where T : IComparable<T>
      {
        int min = 0;
        int max = list.Count;
        while (min < max)
        {
          var mid = (min + max) / 2;
          if (list[mid].CompareTo(x) >= 0)
          {
            max = mid;
          }
          else
          {
            min = mid + 1;
          }
        }
        return max;
      }
      public static int Upperbound<T>(IList<T> list, T x) where T : IComparable<T>
      {
        int min = 0;
        int max = list.Count;
        while (min < max)
        {
          var mid = (min + max) / 2;
          if (list[mid].CompareTo(x) > 0)
          {
            max = mid;
          }
          else
          {
            min = mid + 1;
          }
        }
        return max;
      }

    }

    struct MOD
    {
      public static long P = 1000000007;
      public readonly long V;

      public MOD(long a) { this.V = a % P; }
      public static implicit operator MOD(long a) { return new MOD(a); }
      public static MOD operator +(MOD a, MOD b) { return new MOD((a.V + b.V) % P); }
      public static MOD operator -(MOD a, MOD b) { return new MOD((a.V - b.V + P) % P); }
      public static MOD operator *(MOD a, MOD b) { return new MOD((a.V * b.V) % P); }
      public static MOD operator /(MOD a, MOD b) { return new MOD((a.V * b.Inverse().V) % P); }
      public MOD Inverse()
      {
        long a = V, p = P; long b = p, c = 1, d = 0, e = 0, f = 0;
        while (b != 0) { e = a / b; f = b; b = a - e * b; a = f; f = d; d = c - e * d; c = f; }
        c %= p;
        return c + (c < 0 ? p : 0);
      }
      public MOD Power(long n)
      {
        long a = V, p = P; long res = 1; long mult = a;
        for (int i = 0; i < 63; ++i) { if ((n & ((long)1 << i)) > 0) { res = (res * mult) % p; } mult = (mult * mult) % p; }
        return res;
      }
      public override string ToString() { return V.ToString(); }
    }


    static class Read
{
static Queue<string> queue = new Queue<string>();
static void Enqueue() { var ss = Console.ReadLine().Split(' '); foreach (var s in ss) { queue.Enqueue(s); } }
public static int Int() { if (queue.Count == 0) { Enqueue(); } return Convert.ToInt32(queue.Dequeue()); }
public static long Long() { if (queue.Count == 0) { Enqueue(); } return Convert.ToInt64(queue.Dequeue()); }
public static string Str() { if (queue.Count == 0) { Enqueue(); } return queue.Dequeue(); }
public static int[] IntN() { return Console.ReadLine().Split(' ').Select(s => Convert.ToInt32(s)).ToArray(); }
public static long[] LongN() { return Console.ReadLine().Split(' ').Select(s => Convert.ToInt64(s)).ToArray(); }
public static ulong[] ULongN() { return Console.ReadLine().Split(' ').Select(s => Convert.ToUInt64(s)).ToArray(); }
public static string[] StrN() { return Console.ReadLine().Split(' '); }
public static Tuple<int, int>[] TupleInt(int n) { List<Tuple<int, int>> list = new List<Tuple<int, int>>(); for (int i = 0; i < n; ++i) { var ab = Read.IntN(); list.Add(new Tuple<int, int>(ab[0], ab[1])); } return list.ToArray(); }
public static Tuple<long, long>[] TupleLong(int n) { List<Tuple<long, long>> list = new List<Tuple<long, long>>(); for (int i = 0; i < n; ++i) { var ab = Read.LongN(); list.Add(new Tuple<long, long>(ab[0], ab[1])); } return list.ToArray(); }
public static Tuple<string, string>[] TupleStr(int n) { List<Tuple<string, string>> list = new List<Tuple<string, string>>(); for (int i = 0; i < n; ++i) { var ab = Read.StrN(); list.Add(new Tuple<string, string>(ab[0], ab[1])); } return list.ToArray(); }
public static Tuple<double, double>[] TupleDouble(int n) { List<Tuple<double, double>> list = new List<Tuple<double, double>>(); for (int i = 0; i < n; ++i) { var ab = Read.LongN(); list.Add(new Tuple<double, double>(ab[0], ab[1])); } return list.ToArray(); }
public static long[,] LongMatrix(int r, int c) { var mat = new long[r, c]; for (int i = 0; i < r; ++i) { var x = Read.LongN(); for (int j = 0; j < c; ++j) { mat[i, j] = x[j]; } } return mat; }
public static Dictionary<int, HashSet<int>> AdjacencyList(int N, int M, bool isDirectional = false)
{
Dictionary<int, HashSet<int>> dict = new Dictionary<int, HashSet<int>>();
for (int i = 0; i <= N; ++i) { dict.Add(i, new HashSet<int>()); }
for (int i = 0; i < M; ++i) { var ab = Read.IntN(); if (!dict[ab[0]].Contains(ab[1])) { dict[ab[0]].Add(ab[1]); } if (!isDirectional && !dict[ab[1]].Contains(ab[0])) { dict[ab[1]].Add(ab[0]); } }
return dict;
}
public static Dictionary<int, Dictionary<int, long>> AdjacencyListWithWeight(int N, int M, bool isDirectional = false)
{
Dictionary<int, Dictionary<int, long>> dict = new Dictionary<int, Dictionary<int, long>>(); for (int i = 0; i <= N; ++i) { dict.Add(i, new Dictionary<int, long>()); }
for (int i = 0; i < M; ++i) { var ab = Read.IntN(); dict[ab[0]].Add(ab[1], ab[2]); if (!isDirectional) { dict[ab[1]].Add(ab[0], ab[2]); } }
return dict;
}
}
    }
}


Measured memory_bytes: 26576