a[6d6]; n,m; { a[2]=1; rd(n,m); a[3..n]=(a[1..n-2]+a[2..n-1])%m; wt(a[n]); }