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: #include <bits/stdc++.h>
  using namespace std;
  long long power(long long x, long long y);
  bool isPrime(long long n);
  long long modInv(long long a, long long b);
  long long gcdExtended(long long a, long long b, long long *x, long long *y);
  long long mpower(long long a, long long b, long long p);
  bool sorted(vector<long long> v, long long n, long long strict);
  const long long inf = (long long)1e17;
  const long long N = (long long)3e5 + 5;
  string s1, s2;
  long long dp[10][10][10][2][2];
  long long ways(long long i, string s, long long a, long long b, bool o1,
                 bool o2) {
    long long n = s.size();
    if (i == n) {
      if (a || b) return 0;
      if (o1 && o2) {
        return 1;
      }
      return 0;
    }
    if (dp[i][a][b][o1][o2] != -1) return dp[i][a][b][o1][o2];
    long long ans = 0;
    long long d = s[i] - '0';
    for (long long d1 = 0; d1 <= 9; d1++) {
      for (long long d2 = 0; d2 <= 9; d2++) {
        if ((d1 + d2 + b) % 10 == d) {
          long long nc = (d1 + d2 + b) / 10;
          s1.push_back(d1 + '0');
          s2.push_back(d2 + '0');
          long long na = a, nb = b;
          swap(na, nb);
          na = nc;
          long long no1 = o1 || (d1 > 0);
          long long no2 = o2 || (d2 > 0);
          ans += ways(i + 1, s, na, nb, no1, no2);
          s1.pop_back();
          s2.pop_back();
        }
      }
    }
    dp[i][a][b][o1][o2] = ans;
    return ans;
  }
  void solve() {
    string s;
    cin >> s;
    reverse(s.begin(), s.end());
    memset(dp, -1, sizeof(dp));
    ;
    cout << ways(0, s, 0, 0, 0, 0) << endl;
  }
  int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ;
    clock_t start, end;
    start = clock();
    long long x;
    cin >> x;
    while (x--) {
      solve();
    };
    end = clock();
    double time_taken = double(end - start) / (double)CLOCKS_PER_SEC;
    return 0;
  }
  long long modInv(long long a, long long m) {
    long long x, y;
    long long g = gcdExtended(a, m, &x, &y);
    long long res = (x % m + m) % m;
    return res;
  }
  long long gcdExtended(long long a, long long b, long long *x, long long *y) {
    if (a == 0) {
      *x = 0, *y = 1;
      return b;
    }
    long long x1, y1;
    long long gcd = gcdExtended(b % a, a, &x1, &y1);
    *x = y1 - (b / a) * x1;
    *y = x1;
    return gcd;
  }
  long long mpower(long long x, long long y, long long p) {
    long long res = 1;
    x = x % p;
    while (y > 0) {
      if (y & 1) res = (res * x) % p;
      y = y >> 1;
      x = (x * x) % p;
    }
    return res;
  }
  long long power(long long x, long long y) {
    long long res = 1;
    while (y > 0) {
      if (y & 1) res = res * x;
      y = y >> 1;
      x = x * x;
    }
    return res;
  }
  bool isPrime(long long n) {
    if (n <= 1) return false;
    if (n <= 3) return true;
    if (n % 2 == 0 || n % 3 == 0) return false;
    long long p = sqrt(n);
    for (long long i = 5; i <= p; i = i + 6)
      if (n % i == 0 || n % (i + 2) == 0) return false;
    return true;
  }
  bool sorted(vector<long long> v, long long n, long long strict) {
    if (n <= 1) return 1;
    for (long long i = 1; i < n; i++) {
      if (strict) {
        if (v[i] <= v[i - 1]) return 0;
      } else {
        if (v[i] < v[i - 1]) return 0;
      }
    }
    return 1;
  }
  