for _ in range(int(input())):
s=input()
a=0
b=0
for i in range(len(s)):
if i%2==0:
a=a*10+int(s[i])
else:
b=b*10+int(s[i])
print((a+1)*(b+1)-2)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
#ifndef ONLINE_JUDGE
// For getting input from input.txt file
freopen("input.txt", "r", stdin);
// Printing the Output to output.txt file
freopen("output.txt", "w", stdout);
#endif
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int t; cin>>t;
// cout<<t<<endl;
while(t--)
{
string n;
cin>>n;
string a,b;
// cin>>a>>b;
for (int i = n.size()-1; i>=0; --i)
{
if((n.size()-i)%2)
{
a.push_back(n[i]);
}
else b.push_back(n[i]);
/* code */
}
reverse(a.begin(), a.end());
reverse(b.begin(), b.end());
int i=0;
while(a[i]=='0' && i<a.size())
{
i++;
}
int j=0;
while(b[j]=='0' && j<b.size())
{
j++;
}
string aa,bb;
for (int k = i; k <a.size() ; ++k)
{
aa.push_back(a[k]);
/* code */
}
for (int k = j; k <b.size() ; ++k)
{
bb.push_back(b[k]);
/* code */
}
// cout<<aa<<" "<<bb<<endl;
stringstream geek(aa);
int x=0;
geek>>x;
stringstream geeks(bb);
int y=0;
geeks>>y;
// if(x%10==0)
// {
// x--;
// }
// // if(y%10==0 || y<10)
// // {
// // // y--;
// // }
// if((aa.size()+bb.size())%2==1)cout<<(x+1)*(y)<<endl;
// else cout<<(x)*(y+1)<<endl;
cout<<(x+1)*(y+1)-2<<endl;
}
return 0;
}
435. Non-overlapping Intervals | 406. Queue Reconstruction by Height |
380. Insert Delete GetRandom O(1) | 332. Reconstruct Itinerary |
368. Largest Divisible Subset | 377. Combination Sum IV |
322. Coin Change | 307. Range Sum Query - Mutable |
287. Find the Duplicate Number | 279. Perfect Squares |
275. H-Index II | 274. H-Index |
260. Single Number III | 240. Search a 2D Matrix II |
238. Product of Array Except Self | 229. Majority Element II |
222. Count Complete Tree Nodes | 215. Kth Largest Element in an Array |
198. House Robber | 153. Find Minimum in Rotated Sorted Array |
150. Evaluate Reverse Polish Notation | 144. Binary Tree Preorder Traversal |
137. Single Number II | 130. Surrounded Regions |
129. Sum Root to Leaf Numbers | 120. Triangle |
102. Binary Tree Level Order Traversal | 96. Unique Binary Search Trees |
75. Sort Colors | 74. Search a 2D Matrix |