#include using namespace std; #define LL long long #define lowbit(x) ((x) & -(x)) #define lson l,mid,id<<1 #define rson mid+1,r,id<<1|1 #define MID(l, r) (((l)+(r))>>1) const int maxn = (int) 5e2 + 20; const int MOD = 1e9 + 7; //const int MOD = 998244353; const double eps = 1e-8; inline int sig(double x) {return x < -eps ? -1 : x > eps;} template < typename T > inline void read(T &x) { static bool f; static char ch; f = 0; x = 0; ch = getchar(); while(ch < '0' || '9' < ch) {if(ch == '-') f = 1; ch = getchar();} while('0' <= ch && ch <= '9') {x = (x << 3) + (x << 1) + (ch - '0'); ch = getchar();} if(f) x = -x; } LL gcd(LL a, LL b) {if(!b) return a; return gcd(b, a % b);} LL fp(LL a, LL n, LL m = MOD) {LL res; for(res = 1; n; a = a * a % m, n >>= 1) if(n & 1) res = res * a % m; return res;} int n; void work() { cin >>n; int cnt = 0; vector ans; int tot = 0; int tmp = n; while(tmp) { tot += tmp % 10; tmp /= 10; } for(int i = 1; i <= tot; i++) { if(n % i == 0 && tot % i == 0) ans.push_back(i); } cout <>tc; for(int ca = 1; ca <= tc; ca++) { // printf("Case #%d: ", ca); work(); } return 0; }