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.OutputStream;
  import java.io.IOException;
  import java.io.InputStream;
  import java.io.PrintWriter;
  import java.util.Arrays;
  import java.io.IOException;
  import java.util.InputMismatchException;
  import java.io.InputStream;
  
  /**
   * Built using CHelper plug-in
   * Actual solution is at the top
   *
   * @author dauom
   */
  public class Main {
    public static void main(String[] args) {
      InputStream inputStream = System.in;
      OutputStream outputStream = System.out;
      InputReader in = new InputReader(inputStream);
      PrintWriter out = new PrintWriter(outputStream);
      CCarryingConundrum solver = new CCarryingConundrum();
      int testCount = Integer.parseInt(in.next());
      for (int i = 1; i <= testCount; i++)
        solver.solve(i, in, out);
      out.close();
    }
  
    static class CCarryingConundrum {
      static final int[] g = new int[20];
      private int[][][] dp;
  
      static {
        for (int i = 0; i <= 9; i++) {
          for (int j = 0; j <= 9; j++) {
            g[i + j]++;
          }
        }
      }
  
      public final void solve(int testNumber, InputReader in, PrintWriter out) {
        char[] s = in.nextCharArray();
        dp = new int[s.length + 2][2][2];
        ArrayUtils.deepFill(dp, -1);
        out.println(ways(s, 0, false, false) - 2);
      }
  
      private int ways(char[] s, int i, boolean c1, boolean c2) {
        if (i == s.length) {
          return c1 || c2 ? 0 : 1;
        }
        if (dp[i][c1 ? 1 : 0][c2 ? 1 : 0] >= 0) {
          return dp[i][c1 ? 1 : 0][c2 ? 1 : 0];
        }
  
        final int num = s[i] - '0' + (c2 ? 10 : 0);
        return dp[i][c1 ? 1 : 0][c2 ? 1 : 0] = get(num - 1) * ways(s, i + 1, true, c1) + get(num) * ways(s, i + 1, false, c1);
      }
  
      private int get(int x) {
        if (x < 0) {
          return 0;
        }
        return g[x];
      }
  
    }
  
    static final class ArrayUtils {
      private ArrayUtils() {
        throw new RuntimeException("DON'T");
      }
  
      public static final void deepFill(Object o, int v) {
        if (!o.getClass().isArray()) {
          throw new IllegalArgumentException();
        }
        if (o instanceof int[]) {
          int[] arr = (int[]) o;
          Arrays.fill(arr, v);
        } else if (o instanceof Integer[]) {
          Integer[] arr = (Integer[]) o;
          Arrays.fill(arr, v);
        } else {
          Object[] objArray = (Object[]) o;
          for (Object obj : objArray) {
            deepFill(obj, v);
          }
        }
      }
  
    }
  
    static final class InputReader {
      private final InputStream stream;
      private final byte[] buf = new byte[1 << 18];
      private int curChar;
      private int numChars;
  
      public InputReader() {
        this.stream = System.in;
      }
  
      public InputReader(final InputStream stream) {
        this.stream = stream;
      }
  
      private int read() {
        if (this.numChars == -1) {
          throw new UnknownError();
        } else {
          if (this.curChar >= this.numChars) {
            this.curChar = 0;
  
            try {
              this.numChars = this.stream.read(this.buf);
            } catch (IOException ex) {
              throw new InputMismatchException();
            }
  
            if (this.numChars <= 0) {
              return -1;
            }
          }
  
          return this.buf[this.curChar++];
        }
      }
  
      public final String next() {
        int c;
        while (isSpaceChar(c = this.read())) {
        }
  
        StringBuilder result = new StringBuilder();
        result.appendCodePoint(c);
  
        while (!isSpaceChar(c = this.read())) {
          result.appendCodePoint(c);
        }
  
        return result.toString();
      }
  
      private static boolean isSpaceChar(final int c) {
        return c == 32 || c == 10 || c == 13 || c == 9
            || c == -1; // 32 == ' ', 10 == '\n', 13 == '\r', 9 == '\t'
      }
  
      public final char[] nextCharArray() {
        return next().toCharArray();
      }
  
    }
  }
  
  