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");

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);
    }
    auto res = new long[](N+1);
    res[] = long.max;
    auto xs = new bool[](N);
    auto ys = new bool[](N);
    foreach (b; 0..3^^N) {
        int c;
        size_t i;
        xs[] = false;
        ys[] = false;
        while (b) {
            auto x = b%3;
            if (x == 1) {
                xs[i] = true;
                ++c;
            } else if (x == 2) {
                ys[i] = true;
                ++c;
            }
            ++i;
            b /= 3;
        }
        long s;
        foreach (r; rs) {
            long d = min(abs(r.x), abs(r.y)) * r.p;
            foreach (j, x; xs) if (x) {
                d = min(d, abs(r.x - rs[j].x) * r.p);
            }
            foreach (j, y; ys) if (y) {
                d = min(d, abs(r.y - rs[j].y) * r.p);
            }
            s += d;
        }
        res[c] = min(res[c], s);
    }
    foreach (r; res) writeln(r);
}