int f[100],g[100]; ll@n,@m; ll h=Factor(m,f,g); Mint z=1; rep[g](i,h){ Matrix a(i+1,i+1); rep(y,i+1){ rep(x,i+1){ a[y][x]=y+x<=i?1:0; } } a**=n-1; Mint w=0; rep(y,i+1){ rep(x,i+1){ w+=a[y][x]; } } z*=w; } wt(z);