#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int strpos(char s[], char p[]);

char *string_substring(char str[], int start, int end);

int main(int argc, char **argv)
{
    int a = 0;
    char linha[12];
    char csplit[2] = " ";
    char ing[11][17] = {"Milho verde", "Oleo vegetal", "Acucar", "Fuba", "Ovos", "Farinha de trigo", "Coco ralado", "Fermento em po", "Leite de coco", "Chocolate em po", "Leite"};
    int qr[11][4] = {
        {200, 0, 0, 0},
        {200, 120, 240, 0},
        {250, 360, 160, 0},
        {200, 0, 0, 0},
        {4, 4, 2, 0},
        {15, 240, 240, 0},
        {15, 100, 0, 0},
        {5, 10, 15, 0},
        {0, 200, 0, 0},
        {0, 0, 90, 0},
        {0, 0, 240, 0}};
    char med[11][3] = {"Kg", "L", "Kg", "Kg", "", "Kg", "Kg", "Kg", "L", "Kg", "L"};

    while (a == 0)
    {

        fgets(linha, 13, stdin);

        if (linha[0] == '0')
        {
            a = 1;
            break;
        }

        int q = atoi(linha);

        for (int x = 0; x < q; x++)
        {

            fgets(linha, 13, stdin);

            int milho = atoi(string_substring(linha, 0, 3));
            int coco = atoi(string_substring(linha, 3, 7));
            int choco = atoi(string_substring(linha, 7, 11));

            for (int i = 0; i < 11; i++)
            {
                qr[i][3] = qr[i][3] + qr[i][0] * milho;
                qr[i][3] = qr[i][3] + qr[i][1] * coco;
                qr[i][3] = qr[i][3] + qr[i][2] * choco;
            }
        }

        for (int x = 0; x < 11; x++)
        {
            if (!strcmp(med[x], ""))
            {
                printf("%s %i%s\n", ing[x], qr[x][3], med[x]);
            }
            else
            {
                printf("%s %i%s\n", ing[x], ((int)qr[x][3]) / 1000, med[x]);
            }
        }
    }

    return 0;
}

char *string_substring(char str[], int start, int end)
{
    int i, j;
    char *sub;

    if (start >= end || end > strlen(str))
    {
        return NULL;
    }

    sub = (char *)malloc(sizeof(char) * (end - start + 1));

    for (i = start, j = 0; i < end; i++, j++)
    {
        sub[j] = str[i];
    }

    sub[j] = '\0';

    return sub;
}
