#include using namespace std; #define REP(i,n) for(int i=0;i P; vector div(ll n){ vector d; for(ll i=1;i*i<=n;i++){ if(n%i==0){ d.push_back(i); if(i!=n/i) d.push_back(n/i); } } return d; } int main(void){ ll i,j; cin.tie(0); ios_base::sync_with_stdio(false); ll p,q; cin >> p >> q; vector a=div(q); vector b; ll s=a.size(); for(i=0;i n,m; ll T=0; for(i=0;i