#include #include #include using namespace std; using ll = long long; void solve(){ ll s,n,k,b; cin>>s>>n>>k>>b; vector use; use.push_back(s); for(int i = 0;i> fac; ll now = b; for(int i = 2;i<=b;i++){ if(now%i!=0) continue; int cnt = 0; while(now%i==0){ now /= i; cnt++; } fac.push_back(make_pair(i,cnt)); } ll ans = 1e9; for(int i = 0;i all; for(int j = 0;j>t; while(t--){ solve(); } }