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;
int n;
int a[85][85], f[85], tmp[85], b[85][85];
void mul() {
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      for (int k = b[i][j] = 0; k < n; k++) {
        b[i][j] += (long long)a[i][k] * a[k][j] % 1000000007;
        b[i][j] %= 1000000007;
      }
    }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) a[i][j] = b[i][j];
}
void mul1() {
  for (int i = 0; i < n; i++)
    for (int j = tmp[i] = 0; j < n; j++) {
      tmp[i] += (long long)a[i][j] * f[j] % 1000000007;
      tmp[i] %= 1000000007;
    }
  for (int i = 0; i < n; i++) f[i] = tmp[i];
}
int main() {
  long long N;
  cin >> N >> n;
  n++;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= i; j++) {
      if (j == 0 || j == i)
        a[i][j] = 1;
      else
        a[i][j] = (a[i - 1][j] + a[i - 1][j - 1]) % 1000000007;
    }
    for (int j = 0; j < n; j++) a[i + n][j] = a[i][j + n] = a[i][j];
  }
  a[n << 1][n << 1] = 1;
  a[n << 1][n - 1] = 1;
  for (int i = 0; i < n << 1; i++) f[i] = 1;
  n = n * 2 + 1;
  for (; N; N >>= 1, mul())
    if (N & 1LL) mul1();
  cout << f[n - 1] << endl;
  return 0;
}