func_code_string: #include<bits/stdc++.h>   using namespace std;   int main()   {    long long t,n,x;    cin>>t;    while(t--)    {     cin>>n>>x;     long long a[n+1],m=30,j,s=0,k,c;     for (long long i = 0; i < n; ++i)     {      cin>>a[i];      k=a[i];      c=0;      while(k%x==0)      {       k/=x;       c++;      }      if (m>c)       m=c,j=i;     }     //cout<<m<<   <<j<<endl;     for (long long i = 0; i < n; ++i)     {      s+=(m+1)*a[i];     }     for (long long i = 0; i < j; ++i)     {      s+=a[i];     }     cout<<s<<endl;    }   }