#include <bits/stdc++.h>   using namespace std;   int main() {     int t, cont = 0, z = 0, x, n;     int a[] = {1, 3, 6};     cin >> t;     for (int i = 0; i < t; i++) {       cin >> n;       x = n;       while (x > 0) {         x = x / 10;         z++;       }       if (z == 4) {         for (int k = 1; k <= 9; k++) {           if (n % 10 == k) {             cout << k * 10 << endl;           }         }       } else {         for (int j = 0; j < 3; j++) {           if (z == (j + 1)) {             cont += a[j];           }         }         for (int l = 1; l <= 9; l++) {           if (n % 10 == l) {             cout << ((l - 1) * 10) + cont << endl;           }         }       }       cont = 0;       z = 0;     }     return 0;   }   