import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric, std.container, std.range;

alias R = Tuple!(long, "x", long, "y", long, "p");

long[16] res;
long[15] ds;

void main()
{
    auto N = readln.chomp.to!int;
    R[] rs;
    foreach (_; 0..N) {
        auto r = readln.split.to!(long[]);
        auto x = r[0];
        auto y = r[1];
        auto p = r[2];
        rs ~= R(x, y, p);
    }
    res[] = long.max;
    res[N] = 0;
    foreach (b; 0..3^^N) {
        int c;
        foreach (i, r; rs) {
            ds[i] = min(abs(r.x), abs(r.y)) * r.p;
        }
        foreach (j; 0..N) {
            auto p = b%3;
            if (p) {
                ++c;
                foreach (i, r; rs) {
                    if (p == 1) ds[i] = min(ds[i], abs(r.x - rs[j].x) * r.p);
                    if (p == 2) ds[i] = min(ds[i], abs(r.y - rs[j].y) * r.p);
                }
            }
            b /= 3;
        }
        long s;
        foreach (d; ds[0..N]) s += d;
        res[c] = min(res[c], s);
    }
    foreach (r; res[0..N+1]) writeln(r);
}