PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#QHD0000004. Tổ hợp gieo xúc xắc (Dice Combinations)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Tổ hợp gieo xúc xắc (Dice Combinations)

Dice Combinations

Source: CSES

Problem Statement

A standard die has six faces numbered from 11 through 66. Each throw produces the number shown on the upper face.

Count the number of ordered sequences of at least one throw whose sum is exactly nn. Sequences with the same values in different orders are counted separately.

Print the answer modulo 109+710^9+7.

Input

The input consists of one integer nn, the target sum.

Output

Print one integer: the number of valid sequences modulo 109+710^9+7.

Subtasks

  • Subtask 1 (20 points): 1≤n≤301\le n\le 30.
  • Subtask 2 (30 points): 1≤n≤2⋅1041\le n\le 2\cdot10^4.
  • Subtask 3 (50 points): 1≤n≤1061\le n\le 10^6.

Examples

Input

3

Output

4

Explanation

Exactly four roll sequences total 33: (1,1,1)(1,1,1), (1,2)(1,2), (2,1)(2,1), and (3)(3). The sequences (1,2)(1,2) and (2,1)(2,1) are distinct because order matters.