def prod(mat1,mat2,mod): n=len(mat1) ret=[[0]*n for _ in range(n)] for i in range(n): for j in range(n): for k in range(n): ret[i][j]+=mat1[i][k]*mat2[k][j] ret[i][j]%=mod return ret n,m=map(int,input().split()) n-=2 matrix=[[1,1],[1,0]] tmp=[[1,0],[0,1]] for i in range(33): if n&(1<