#include #include void run(void){ char *s=(char *)malloc(sizeof(char)*(10000+1)); scanf("%s",s); int m; scanf("%d",&m); short *mul=(short *)malloc(sizeof(short)*10*m); int i,j; for(i=0;i<10;i++){ for(j=0;j=mod?t-mod:t; } if(d==0){ cnt++; } else{ next[d%m]=next[d%m]==mod-1?0:next[d%m]+1; } int *swap=now; now=next; next=swap; } printf("%d\n",(now[0]+cnt)%mod); } int main(void){ run(); return 0; }