import java.io.*;
import java.util.*;

public class academy_as implements Runnable {
    private final static double EPS = 1e-9;

    double a;
    double b;

    class Person {
        int i;
        double p;
        double q;
        double s;
        double c;
        double v;
        double t;

        public Person(int i, double p, double q, double s) {
            this.i = i;
            this.p = p;
            this.q = q;
            this.s = s;
            c = a / q;
            v = p / s;
        }
    }

    public void solve() throws IOException {
        Scanner in = new Scanner(new File("academy.in"));
        PrintWriter out = new PrintWriter(new File("academy.out"));

        int n = in.nextInt();
        a = in.nextInt();
        b = in.nextInt();
        Person[] p = new Person[n];
        for (int i = 0; i < n; i++) {
            p[i] = new Person(i, in.nextInt(), in.nextInt(), in.nextInt());
        }

        Arrays.sort(p, new Comparator<Person>() {
            public int compare(Person o1, Person o2) {
                return o1.v < o2.v ? 1 : o1.v > o2.v ? -1 : 0;
            }
        });

        double u = 0;
        int k = 0;
        double tot = 0;
        while (u < b - EPS && k < n) {
            if (b - u >= p[k].c * p[k].s) {
                p[k].t = p[k].c;
            } else {
                p[k].t = (b - u) / p[k].s;
            }
            u += p[k].t * p[k].s;
            tot += p[k].t * p[k].p;
            k++;
        }

        out.println(tot);
        double z;
        if (u < b - EPS) {
            z = 0;
        } else {
            z = p[k - 1].p / p[k - 1].s;
        }

        Arrays.sort(p, new Comparator<Person>() {
            public int compare(Person o1, Person o2) {
                return o1.i - o2.i;
            }
        });
        out.println(z);
        for (int i = 0; i < n; i++) {
            out.print(Math.max((p[i].p - p[i].s * z) / p[i].q, 0));
            if (i < n - 1) {
                out.print(" ");
            }
        }
        out.println();

        in.close();
        out.close();
    }

    public void run() {
        try {
            solve();
        } catch (IOException e) {
            System.exit(64);
        }
    }

    public static void main(String[] arg) throws IOException {
        new Thread(new academy_as()).start();
    }
}
