#include using namespace std; typedef vector VI; typedef vector VVI; typedef vector VS; typedef pair PII; typedef long long LL; typedef pair PLL; #define ALL(a) (a).begin(),(a).end() #define RALL(a) (a).rbegin(), (a).rend() #define PB push_back #define EB emplace_back #define MP make_pair #define SZ(a) int((a).size()) #define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i) #define EXIST(s,e) ((s).find(e)!=(s).end()) #define SORT(c) sort((c).begin(),(c).end()) #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) #define FF first #define SS second template istream& operator>>(istream& is, pair& p){ return is >> p.FF >> p.SS; } const double EPS = 1e-10; const double PI = acos(-1.0); const LL MOD = 1e9+7; typedef vector Col; typedef vector Matrix; LL A[1260][1260]; LL p[1260][1260]; LL u[1260]; LL next_e1[1260]; LL kitamasa(int K, LL n){ u[0] = 1; REP(i,K-1) p[i][i+1] = 1; REP(i,K) p[K-1][i] = A[K-1][i]; for(;n>0;n>>=1){ if(n%2 == 1){ LL tmp[1260]; REP(i,K) tmp[i] = u[i]; for(int i=0;i= MOD) u[i] -= MOD; } } } memset(next_e1, 0, sizeof(next_e1)); for(int i=0;i= MOD) next_e1[i] -= MOD; } for(int i=0;i= MOD) res -= MOD; } return res; } const int MAX = 660; LL dp1[7][51][MAX]; LL dp2[7][51][MAX]; int main(){ cin.tie(0); ios_base::sync_with_stdio(false); VI ps{2,3,5,7,11,13}; VI qs{4,6,8,9,10,12}; LL N, P, C; cin >> N >> P >> C; dp1[0][0][0] = 1; for(int i=0;i<6;++i) for(int j=0;j<=P;++j) for(int k=j;k<=P;++k){ int tmp = ps[i]*(k-j); for(int n=0;n+tmp pat(D); REP(n1,MAX) REP(n2,MAX) (pat[n1+n2] += dp1[6][P][n1] * dp2[6][C][n2]) %= MOD; REP(i,D-1) A[i][i+1] = 1; FOR(i,1,D) A[D-1][D-i] = pat[i]; cout << kitamasa(D, N) << endl; return 0; }