#include using namespace std; #define MAXN 1005 #define P 1000000007 int t,n,m,i,j,a[MAXN],k; int main() { scanf("%d",&t); while(t--) { scanf("%d",&n); for(i=n,m=0;i;i/=10)m+=i%10; for(k=0,j=1;j<=m;j++)if(m%j==0&&n%j==0)a[++k]=j; cout<