description: Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully — instead of carrying to the next column, she carries to the column two columns to the left.
  
  For example, the regular way to evaluate the sum 2039 + 2976 would be as shown: 
  
  <image>
  
  However, Alice evaluates it as shown: 
  
  <image>
  
  In particular, this is what she does: 
  
    * add 9 and 6 to make 15, and carry the 1 to the column two columns to the left, i. e. to the column "0 9"; 
    * add 3 and 7 to make 10 and carry the 1 to the column two columns to the left, i. e. to the column "2 2"; 
    * add 1, 0, and 9 to make 10 and carry the 1 to the column two columns to the left, i. e. to the column above the plus sign; 
    * add 1, 2 and 2 to make 5; 
    * add 1 to make 1. 
  
  Thus, she ends up with the incorrect result of 15005.
  
  Alice comes up to Bob and says that she has added two numbers to get a result of n. However, Bob knows that Alice adds in her own way. Help Bob find the number of ordered pairs of positive integers such that when Alice adds them, she will get a result of n. Note that pairs (a, b) and (b, a) are considered different if a ≠ b.
  
  Input
  
  The input consists of multiple test cases. The first line contains an integer t (1 ≤ t ≤ 1000) — the number of test cases. The description of the test cases follows.
  
  The only line of each test case contains an integer n (2 ≤ n ≤ 10^9) — the number Alice shows Bob.
  
  Output
  
  For each test case, output one integer — the number of ordered pairs of positive integers such that when Alice adds them, she will get a result of n. 
  
  Example
  
  Input
  
  
  5
  100
  12
  8
  2021
  10000
  
  
  Output
  
  
  9
  4
  7
  44
  99
  
  Note
  
  In the first test case, when Alice evaluates any of the sums 1 + 9, 2 + 8, 3 + 7, 4 + 6, 5 + 5, 6 + 4, 7 + 3, 8 + 2, or 9 + 1, she will get a result of 100. The picture below shows how Alice evaluates 6 + 4: 
  
  <image>
solution: 					/*
  					ID: abdelra29
  LANG: JAVA
  PROG: zerosum
  					*/
  						/*
  						TO LEARN
  				
  						2-euler tour
  					
  						*/
  						/*
  						TO SOLVE 
  						*/
  						/*
  						bit manipulation shit
  						1-Computer Systems: A Programmer's Perspective
  						2-hacker's delight
  						*/
  						/*
  						TO WATCH
  						
  						*/
  						            import java.util.*;
  								    import java.math.*;
  								    import java.io.*; 
  								    import java.util.stream.Collectors;
  
  								       public class A{
  						            static FastScanner scan=new FastScanner();
  									     public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
  
  static void cal(int a,int b,int req)
  {
  	int arr[]=new int[100];
  	
  	String aa=String.valueOf(a),bb=String.valueOf(b);
  	int arr1[]=new int[100];
  	int arr2[]=new int[100];
  	for(int i=99,id=aa.length()-1;i>=0&&id>=0;id--,i--)
  		arr1[i]=aa.charAt(id)-'0';
  	for(int i=99,id=bb.length()-1;i>=0&&id>=0;id--,i--)
  		arr2[i]=bb.charAt(id)-'0';
  	int last=-1;
  	//System.out.println("FO "+arr1[99]);
  	for(int i=99;i>=0;i--)
  	{
  		if(arr1[i]==0&&arr2[i]==0)
  		{
  		//	System.out.println("F "+i);
  
  			continue;
  			//last=i;
  			//break;
  		}
  
  		int res=arr1[i]+arr2[i];
  		String rr=String.valueOf(res);
  		arr[i]=rr.charAt(rr.length()-1)-'0';
  		//if(i==98)
  		//	System.out.println(arr1[i]+" "+arr2[i]+" "+res+" "+arr[i]);
  		//System.out.println("F "+rr.charAt(rr.length()-1));
  		StringBuilder op=new StringBuilder("");
  		for(int j=rr.length()-2;j>=0;j--)
  			op.append(rr.charAt(j));
  		op.reverse();
  	//	System.out.println("OP "+op);
  	//	System.out.println(rr.charAt(rr.length()-1));
  		if(op.length()>0){
  
  	arr1[i-2]+=Integer.parseInt(op.toString());
  	//System.out.println(arr1[i-2]);
  }
  	}
  	StringBuilder ok=new StringBuilder("");
  	for(int i=0;i<100;i++){
  		//System.out.println("PO "+arr1[i]);
  		ok.append(arr[i]);
  	}
  	//System.out.println("FFF "+arr[99]);
  	//System.out.println(Integer.parseInt(ok.toString()));
  	if(Integer.parseInt(ok.toString())==req)
  	{
  		System.out.println(a+" "+b);
  	}
  }
  static ArrayList<Integer>digits;
  static long dp[][][];
  static long rec(int i,int carrya,int carryb)
  {
  	if(i<0){
  		//System.out.println("FUCK");
  		if(carryb+carrya>0)
  			return 0;
  		return 1;
  	}
  	if(dp[i][carrya][carryb]!=-1)
  		return dp[i][carrya][carryb];
  	long res=0;
  	for(int f=0;f<10;f++)
  	{
  		for(int s=0;s<10;s++)
  		{
  			int val=(f+s+carryb);
  			if((val%10)==digits.get(i))
  			{
  				//out.println(val+" "+f+" "+s);
  				res+=rec(i-1,val/10,carrya);
  			}
  		}
  	}
  	return dp[i][carrya][carryb]=res;
  }
  		public static void main(String[] args)  throws Exception 
  						      {
  						 /*
  						 very important tips 
  						 1-just fucking think backwards once in your shitty life
  						 2-consider brute forcing and finding some patterns and observations
  						 3-when you're in contest don't get out because you think there is no enough time
  						 4-don't get stuck on one approach 
  						 */
  					    //	File file=new File("D:\\input\\out.txt");
  				   //scan=new FastScanner("halfnice.in");
  					//	out = new PrintWriter("moop.out");
  					
  								 							 /*
  								 READING 
  						
  								 3-Introduction to DP with Bitmasking codefoces
  								 4-Bit Manipulation hackerearth
  								 5-read more about mobious and inculsion-exclusion 
  								 6-read more about fermat little theorem
  								 */
  								
  					//System.out.println(0^1^1);
  							
  								int tt =1;
  								//cal(100,110,12);
  
  								tt=scan.nextInt();
  							int T=1;
  
  							 outer:while(tt-->0)
  								    {
  								    	int n=scan.nextInt();
  								    	Set<Pair>set=new HashSet<Pair>();
  								    	/*for(int i=1;i<=1000;i++)
  								    		for(int j=1;j<=1000;j++){
  								    		//	set.add(new Pair(i,j));
  								    			cal(i,j,n);
  								    		}*/
  								    		digits=new ArrayList<Integer>();
  								    		while(n>0)
  								    		{
  								    			digits.add(n%10);
  								    			n/=10;
  								    		}
  								    		Collections.reverse(digits);
  								    		dp=new long[20][20][20];
  								    		for(long KK[][]:dp)
  								    		for(long K[]:KK)
  								    		Arrays.fill(K,-1);								    		
  								    		out.println(rec(digits.size()-1,0,0)-2);
  
  				   
  								
  								    	
   }								    									   
  		out.close();
  					}
  					
  					
  
  					static class special implements Comparable<special>{
  					int cnt,idx;
  					String s;
  					public special(int cnt,int idx,String s)
  					{
  						this.cnt=cnt;
  						this.idx=idx;
  						this.s=s;
  					}
  
  						 @Override
  								            public int hashCode() {
  								                return (int)42;
  								            }
  						  @Override
  								            public boolean equals(Object o){
  								            //	System.out.println("FUCK");
  								                if (o == this) return true;
  								                if (o.getClass() != getClass()) return false;
  								                special t = (special)o;
  								                return t.cnt == cnt && t.idx == idx;
  								            }
  								            public int compareTo(special o1)
  								            {
  								            	if(o1.cnt==cnt)
  								            	{
  								            		return o1.idx-idx;
  								            	}
  								            	return o1.cnt-cnt;
  								            }
  					}
  		
  								   
  								     static long binexp(long a,long n)
  								    {
  								        if(n==0)
  								            return 1;
  								        long res=binexp(a,n/2);
  								        if(n%2==1)
  								            return res*res*a;
  								        else 
  								            return res*res;
  								    }
  								     
  								    static long powMod(long base, long exp, long mod) {
  								           if (base == 0 || base == 1) return base;
  								           if (exp == 0) return 1;
  								           if (exp == 1) return (base % mod+mod)%mod;
  								           long R = (powMod(base, exp/2, mod) % mod+mod)%mod;
  								           R *= R;
  								           R %= mod;
  								           if ((exp & 1) == 1) {
  								               return (base * R % mod+mod)%mod;
  								           }
  								           else return (R %mod+mod)%mod;
  								       }
  								    static double dis(double x1,double y1,double x2,double y2)
  								    {
  								        return Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
  								    }
  								    static long mod(long x,long y)
  								        {
  								            if(x<0)
  								                x=x+(-x/y+1)*y;
  								            return x%y;
  								        }
  								     public static  long pow(long b, long e) {
  								                long r = 1;
  								                while (e > 0) {
  								                    if (e % 2 == 1) r = r * b ;
  								                    b = b * b;
  								                    e >>= 1;
  								                }
  								                return r;
  								            }
  								    private static void sort(int[] arr) {
  								            List<Integer> list = new ArrayList<>();
  								            for (int object : arr) list.add(object);
  								            Collections.sort(list);
  								        //Collections.reverse(list);
  								            for (int i = 0; i < list.size(); ++i) arr[i] = list.get(i);
  								        }
  								    private static void sort2(long[] arr) {
  								            List<Long> list = new ArrayList<>();
  								            for (Long object : arr) list.add(object);
  								            Collections.sort(list);
  								        Collections.reverse(list);
  								            for (int i = 0; i < list.size(); ++i) arr[i] = list.get(i);
  								        }
  								     static class FastScanner
  						{
  						    private int BS = 1 << 16;
  						    private char NC = (char) 0;
  						    private byte[] buf = new byte[BS];
  						    private int bId = 0, size = 0;
  						    private char c = NC;
  						    private double cnt = 1;
  						    private BufferedInputStream in;
  						 
  						    public FastScanner() {
  						        in = new BufferedInputStream(System.in, BS);
  						    }
  						 
  						    public FastScanner(String s) {
  						        try {
  						            in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
  						        } catch (Exception e) {
  						            in = new BufferedInputStream(System.in, BS);
  						        }
  						    }
  						 
  						    private char getChar() {
  						        while (bId == size) {
  						            try {
  						                size = in.read(buf);
  						            } catch (Exception e) {
  						                return NC;
  						            }
  						            if (size == -1) return NC;
  						            bId = 0;
  						        }
  						        return (char) buf[bId++];
  						    }
  						 
  						    public int nextInt() {
  						        return (int) nextLong();
  						    }
  						 
  						    public int[] nextInts(int N) {
  						        int[] res = new int[N];
  						        for (int i = 0; i < N; i++) {
  						            res[i] = (int) nextLong();
  						        }
  						        return res;
  						    }
  						 
  						    public long[] nextLongs(int N) {
  						        long[] res = new long[N];
  						        for (int i = 0; i < N; i++) {
  						            res[i] = nextLong();
  						        }
  						        return res;
  						    }
  						 
  						    public long nextLong() {
  						        cnt = 1;
  						        boolean neg = false;
  						        if (c == NC) c = getChar();
  						        for (; (c < '0' || c > '9'); c = getChar()) {
  						            if (c == '-') neg = true;
  						        }
  						        long res = 0;
  						        for (; c >= '0' && c <= '9'; c = getChar()) {
  						            res = (res << 3) + (res << 1) + c - '0';
  						            cnt *= 10;
  						        }
  						        return neg ? -res : res;
  						    }
  						 
  						    public double nextDouble() {
  						        double cur = nextLong();
  						        return c != '.' ? cur : cur + nextLong() / cnt;
  						    }
  						 
  						    public double[] nextDoubles(int N) {
  						        double[] res = new double[N];
  						        for (int i = 0; i < N; i++) {
  						            res[i] = nextDouble();
  						        }
  						        return res;
  						    }
  						 
  						    public String next() {
  						        StringBuilder res = new StringBuilder();
  						        while (c <= 32) c = getChar();
  						        while (c > 32) {
  						            res.append(c);
  						            c = getChar();
  						        }
  						        return res.toString();
  						    }
  						 
  						    public String nextLine() {
  						        StringBuilder res = new StringBuilder();
  						        while (c <= 32) c = getChar();
  						        while (c != '\n') {
  						            res.append(c);
  						            c = getChar();
  						        }
  						        return res.toString();
  						    }
  						 
  						    public boolean hasNext() {
  						        if (c > 32) return true;
  						        while (true) {
  						            c = getChar();
  						            if (c == NC) return false;
  						            else if (c > 32) return true;
  						        }
  						    }
  						}
  
  								     static class Pair implements Comparable<Pair>{
  								            public long x, y,z;
  								            public Pair(long x1, long y1,long z1) {
  								                x=x1;
  								                y=y1;
  								                z=z1;
  								            }
  								             public Pair(long x1, long y1) {
  								                x=x1;
  								                y=y1;
  								    
  								            }
  								            
  								            @Override
  								            public int hashCode() {
  								                return (int)(x + 31 * y);
  								            }
  								            public String toString() {
  								                return x + " " + y+" "+z;
  								            }
  								            @Override
  								            public boolean equals(Object o){
  								                if (o == this) return true;
  								                if (o.getClass() != getClass()) return false;
  								                Pair t = (Pair)o;
  								                return t.x == x && t.y == y&&t.z==z;
  								            }
  								    public int compareTo(Pair o)
  								    {
  								    								  	
  								  
  								    	return (int)(x-o.x);
  								     
  								        }
  								     
  								    }
  								}
  								
  								    
  								   
  
  								     
  