Problem: Everyone knows what the Fibonacci sequence is. This sequence can be defined by the recurrence relation: 

F1 = 1, F2 = 2, Fi = Fi - 1 + Fi - 2 (i > 2).

We'll define a new number sequence Ai(k) by the formula: 

Ai(k) = Fi × ik (i ≥ 1).

In this problem, your task is to calculate the following sum: A1(k) + A2(k) + ... + An(k). The answer can be very large, so print it modulo 1000000007 (109 + 7).

Input

The first line contains two space-separated integers n, k (1 ≤ n ≤ 1017; 1 ≤ k ≤ 40).

Output

Print a single integer — the sum of the first n elements of the sequence Ai(k) modulo 1000000007 (109 + 7).

Examples

Input

1 1


Output

1


Input

4 1


Output

34


Input

5 2


Output

316


Input

7 4


Output

73825

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int maxn = 2e4 + 500, maxm = 105;
const long long mod = 1e9 + 7;
struct matrix {
  static const int maxr = 83;
  long long m[maxr][maxr];
  int r;
  matrix() { memset(m, 0, sizeof(m)); }
  matrix(int r) : r(r) { memset(m, 0, sizeof(m)); }
  inline matrix operator*(const matrix &T) const {
    matrix t(r);
    for (int i = 0; i < r; i++)
      for (int k = 0; k < r; k++)
        for (int j = 0; j < r; j++) (t.m[i][j] += m[i][k] * T.m[k][j]) %= mod;
    return t;
  }
  matrix pow(long long n) const {
    matrix s(r), t = *this;
    for (int i = 0; i < r; i++) s.m[i][i] = 1;
    while (n) {
      if (n & 1) s = s * t;
      t = t * t;
      n >>= 1;
    }
    return s;
  }
};
int k;
long long n;
void init(matrix &A, matrix &S) {
  for (int i = 0; i <= k; i++)
    A.m[i][k + 1] = A.m[i + k + 1][0] = A.m[i + k + 1][k + 1] = 1;
  for (int i = 1; i <= k; i++)
    for (int j = 1; j <= k; j++)
      A.m[i + k + 1][j] = A.m[i + k + 1][j + k + 1] = A.m[i][j + k + 1] =
          (A.m[i - 1][j + k + 1] + A.m[i - 1][j - 1 + k + 1]) % mod;
  A.m[2 * k + 2][2 * k + 1] = A.m[2 * k + 2][2 * k + 2] = 1;
  for (int i = 0; i < 2 * k + 2; i++) S.m[i][0] = 1;
}
int main() {
  scanf("%I64d%d", &n, &k);
  matrix A(2 * k + 3), S(2 * k + 3);
  init(A, S);
  A = A.pow(n);
  S = A * S;
  printf("%I64d\n", S.m[2 * k + 2][0]);
  return 0;
}