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

namespace ConsoleApplication11
{
    class Program
    {
        static void Main(string[] args)
        {
            int t = Convert.ToInt32(Console.ReadLine());
            int n = t;
            int br = 0;
            int[] a = new int[1000];
            string[] b = new string[1000];
            while (t != 0)
            {
                string x = Console.ReadLine();
                b[br] = x;
                br++;
                t--;
            }
            br = 0;
            for (int i = 0; i < b.Length; i++)
            {
                for (int j = 0; j < b[i].Length; j++)
                {
                    int temp = 1;
                    Console.WriteLine("cifra: " + (Convert.ToInt32(b[i][j]) - '0'));
                    temp = temp * (Convert.ToInt32(b[i][j]) - '0');
                    a[br] = temp;  
                }
            }
            for (int i = 0; i < n; i++)
            {
                Console.WriteLine(a[i]);
            }
            Console.ReadKey();
        }
    }
}