inlinevoidin(R LL &a){ R char c = getchar();R LL x=0,f=1; while(!isdigit(c)){if(c == '-') f=-1; c = getchar();} while(isdigit(c)) x = (x<<1)+(x<<3)+c-'0',c = getchar(); a = x*f; }
inlineintyg(){ in(n),in(m);in(k); R int tot = (1<<m)-1; for(R int i=0; i<=tot; ++i) { R int d = i; for(R int j=1,sum=0; j<=m; ++j) { if(d&1) sum++; d>>=1; if(j==m&&sum<=k) state[++t] = i; } } for(R int i=1; i<=t; ++i) for(R int j=1; j<=t; ++j){ R int x = state[i],y = state[j]; for(R int p=0; p<m-1; ++p) { if(((x>>p)&1) != ((y>>(p+1))&1)) break; if(p == m-2) sure[i][j] = 1; } }
for(R int p=1; p<=t; ++p) { memset(f,0,sizeof(f)); f[m][p]=1; for(R int i=m+1; i<=n+m; ++i) for(R int j=1; j<=t; ++j) for(R int k=1; k<=t; ++k) if(sure[k][j]) f[i][j]=(f[i-1][k]+f[i][j])%mod; ans = (ans+f[m+n][p])%mod; } cout << ans; } int youngsc = yg(); intmain(){;}
# include<algorithm> # include<iostream> # include<cstring> # include<cstdio> # include<cmath> # define R register # define LL long long # define db double # define mod 1000000007LL
usingnamespace std;
LL n,m,k; int f[64],anss,t; int state[64],sure[64][64],ans[64][64]; bool ok[64];
inlinevoidin(R LL &a){ R char c = getchar();R LL x=0,f=1; while(!isdigit(c)){if(c == '-') f=-1; c = getchar();} while(isdigit(c)) x = (x<<1)+(x<<3)+c-'0',c = getchar(); a = x*f; }
inlinevoidpowe(R int a[64][64],R int b[64][64]){ R int d[64][64] = {0}; for(R int i=1; i<=t; ++i) for(R int j=1; j<=t; ++j) for(R int k=1; k<=t; ++k) d[i][j] = (d[i][j]*1LL+(1LL*a[i][k]*b[k][j])%mod)%mod; memcpy(a,d,sizeof(d)); }
inlineintyg(){ in(n),in(m);in(k); R int tot = (1<<m)-1; for(R int i=0; i<=tot; ++i) { R int d = i; for(R int j=1,sum=0; j<=m; ++j) { if(d&1) sum++; d>>=1; if(j==m&&sum<=k) state[++t] = i; } } for(R int i=1; i<=t; ++i) ans[i][i] = 1; for(R int i=1; i<=t; ++i) for(R int j=1; j<=t; ++j){ R int x = state[i],y = state[j]; for(R int p=0; p<m-1; ++p) { if(((x>>p)&1) != ((y>>(p+1))&1)) break; if(p == m-2) sure[i][j] = 1; } }
R LL r = n; while(r) { if(r&1LL) powe(ans,sure); if(r>1LL) powe(sure,sure); r>>=1LL; }
for(R int p=1; p<=t; ++p) anss = (anss*1LL+ans[p][p]*1LL)%mod; cout << anss; } int youngsc = yg(); intmain(){;}