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: import java.io.BufferedReader;
  import java.io.IOException;
  import java.io.InputStreamReader;
  import java.io.PrintWriter;
  import java.util.ArrayList;
  import java.util.Collections;
  import java.util.StringTokenizer;
  
  public class Solve {
  
  	static int mod = 1000_000_000 + 7;
  	static long INF = 1000_000_000_000_000L + 100;
  	static boolean isPrime[];
  
  	public static void main(String[] args) throws Exception {
  		Scanner sc = new Scanner();
  		PrintWriter pw = new PrintWriter(System.out);
  		int t = sc.nextInt();
  
  		while (t-- > 0) {
  			int n = sc.nextInt();
  			int f = 0;
  			int s = 0;
  			String str = n + "";
  			for (int i = 0; i < str.length(); i++) {
  
  				if (i % 2 == 0) {
  					f = f * 10 + str.charAt(i) - '0';
  
  				} else {
  					s = s * 10 + str.charAt(i) - '0';
  
  				}
  			}
  			long ans = ((f + 1) * (s + 1)) - 2;
  			pw.println(ans);
  
  		}
  
  		pw.flush();
  
  	}
  
  	static long LowerBound(int a[], int x, int start) { // x is the target value or key
  		int l = start, r = a.length;
  		while (l + 1 < r) {
  			int m = (l + r) >>> 1;
  			if (a[m] >= x)
  				r = m;
  			else
  				l = m;
  		}
  		return r;
  	}
  
  	static long UpperBound(int a[], int x, int start) {// x is the key or target value
  		int l = start, r = a.length;
  		while (l + 1 < r) {
  			int m = (l + r) >>> 1;
  			if (a[m] <= x)
  				l = m;
  			else
  				r = m;
  		}
  		return l + 1;
  	}
  
  	static public boolean[] sieve(int n) {
  		boolean prime[] = new boolean[n + 1];
  		for (int i = 0; i <= n; i++)
  			prime[i] = true;
  
  		for (int p = 2; p * p <= n; p++) {
  			// If prime[p] is not changed, then it is a
  			// prime
  			if (prime[p] == true) {
  				// Update all multiples of p
  				for (int i = p * p; i <= n; i += p)
  					prime[i] = false;
  			}
  		}
  		return prime;
  
  	}
  
  	public static ArrayList<Integer> primeFactors(int n) {
  		ArrayList<Integer> set = new ArrayList<Integer>();
  
  		// Print the number of 2s that divide n
  		while (n % 2 == 0) {
  			n /= 2;
  			set.add(2);
  		}
  
  		// n must be odd at this point. So we can
  		// skip one element (Note i = i +2)
  		for (int i = 3; i * i <= n; i += 2) {
  			// While i divides n, print i and divide n
  			while (n % i == 0) {
  				n /= i;
  				set.add(i);
  			}
  		}
  
  		if (n > 1)
  			set.add(n);
  
  		return set;
  
  	}
  
  	static int gcd(int a, int b) {
  		if (a == 0)
  			return b;
  		if (b == 0)
  			return a;
  
  		return gcd(b, a % b);
  
  	}
  
  	public static int[] swap(int data[], int left, int right) {
  
  		// Swap the data
  		int temp = data[left];
  		data[left] = data[right];
  		data[right] = temp;
  
  		// Return the updated array
  		return data;
  	}
  
  	static long nCrModp(int n, int r, int p) {
  		if (r > n - r)
  			r = n - r;
  
  		// The array C is going to store last
  		// row of pascal triangle at the end.
  		// And last entry of last row is nCr
  		int C[] = new int[r + 1];
  
  		C[0] = 1; // Top row of Pascal Triangle
  
  		// One by constructs remaining rows of Pascal
  		// Triangle from top to bottom
  		for (int i = 1; i <= n; i++) {
  
  			// Fill entries of current row using previous
  			// row values
  			for (int j = Math.min(i, r); j > 0; j--)
  
  				// nCj = (n-1)Cj + (n-1)C(j-1);
  				C[j] = (C[j] + C[j - 1]) % p;
  		}
  		return C[r];
  	}
  
  	static void sort(int[] a) {
  		ArrayList<Integer> l = new ArrayList<>();
  		for (int i : a)
  			l.add(i);
  		Collections.sort(l);
  		for (int i = 0; i < a.length; i++)
  			a[i] = l.get(i);
  	}
  
  }
  
  class Pair {
  	int x, y;
  
  	Pair(int x, int y) {
  		this.x = x;
  		this.y = y;
  	}
  
  }
  
  class SegTree {
  	int leftmost, rightmost, sum;
  	SegTree lChild, rChild;
  
  	public SegTree(int leftmost, int rightmost) {
  		this.leftmost = leftmost;
  		this.rightmost = rightmost;
  	}
  
  	public void update(int index, int val) {
  		sum++;
  		if (leftmost == rightmost) {
  			return;
  		}
  		if (lChild == null)
  			makeKids();
  		if (index <= lChild.rightmost)
  			lChild.update(index, val);
  		else
  			rChild.update(index, val);
  	}
  
  	public void makeKids() {
  		int mid = (leftmost + rightmost) / 2;
  		lChild = new SegTree(leftmost, mid);
  		rChild = new SegTree(mid + 1, rightmost);
  	}
  
  	public int query(int l, int r) {
  		if (l <= leftmost && r >= rightmost)
  			return sum;
  		if (l > rightmost || r < leftmost)
  			return 0;
  		if (lChild == null)
  			return 0;
  		return lChild.query(l, r) + rChild.query(l, r);
  	}
  }
  
  class UnionFind {
  	int[] p, rank, setSize;
  	int numSets;
  
  	public UnionFind(int N) {
  		p = new int[numSets = N];
  		rank = new int[N];
  		setSize = new int[N];
  		for (int i = 0; i < N; i++) {
  			p[i] = i;
  			setSize[i] = 1;
  		}
  	}
  
  	public int findSet(int i) {
  		return p[i] == i ? i : (p[i] = findSet(p[i]));
  	}
  
  	public boolean isSameSet(int i, int j) {
  		return findSet(i) == findSet(j);
  	}
  
  	public void unionSet(int i, int j) {
  		if (isSameSet(i, j))
  			return;
  		numSets--;
  		int x = findSet(i), y = findSet(j);
  		if (rank[x] > rank[y]) {
  			p[y] = x;
  			setSize[x] += setSize[y];
  		} else {
  			p[x] = y;
  			setSize[y] += setSize[x];
  			if (rank[x] == rank[y])
  				rank[y]++;
  		}
  	}
  
  	public int numDisjointSets() {
  		return numSets;
  	}
  
  	public int sizeOfSet(int i) {
  		return setSize[findSet(i)];
  	}
  }
  
  class Scanner {
  	BufferedReader br;
  	StringTokenizer st;
  
  	Scanner() {
  		br = new BufferedReader(new InputStreamReader(System.in));
  	}
  
  	String next() throws IOException {
  		while (st == null || !st.hasMoreElements())
  			st = new StringTokenizer(br.readLine());
  		return st.nextToken();
  	}
  
  	int nextInt() throws NumberFormatException, IOException {
  		return Integer.parseInt(next());
  	}
  
  	int[] nextIntArray(int n) throws NumberFormatException, IOException {
  		int a[] = new int[n];
  		for (int i = 0; i < n; i++)
  			a[i] = Integer.parseInt(next());
  		return a;
  	}
  
  	long nextLong() throws NumberFormatException, IOException {
  		return Long.parseLong(next());
  	}
  
  	long[] nextLongArray(int n) throws NumberFormatException, IOException {
  		long a[] = new long[n];
  		for (int i = 0; i < n; i++)
  			a[i] = Long.parseLong(next());
  		return a;
  	}
  
  	double nextDouble() throws NumberFormatException, IOException {
  		return Double.parseDouble(next());
  	}
  }