#C8150. Counting Valid Ancient Words

    ID: 52101 Type: Default 1000ms 256MiB

Counting Valid Ancient Words

Counting Valid Ancient Words

In an ancient civilization, words were formed using a set of 5 distinct characters. However, there was a strict rule: the characters in any word must appear in non-decreasing order from left to right. This means that while characters may be repeated, each subsequent character must be equal to or greater than the previous one.

Your task is to compute the number of valid words of length \(N\) under this rule. Mathematically, this is equivalent to finding the number of sequences of length \(N\) chosen from 5 characters with repetition allowed and arranged in non-decreasing order. This count can be expressed as the combinatorial formula \(C(N+4,4)\). Since the answer can be very large, you should compute it modulo \(10^9+7\).

inputFormat

The input consists of a single integer (N) ((1 \leq N \leq 10^6)) representing the length of the word.

outputFormat

Output a single integer which is the number of valid words of length (N) modulo (10^9+7).## sample

1
5

</p>