~/algor $ cat problems/zinapoya
Staircase
Medium
1000 ms
64 MB
45%
A staircase has $n$ steps. In one move you may climb $1$, $2$ or $3$ steps. Find the number of ways to climb from the bottom (step $0$) to exactly step $n$. Two ways are different if their sequences of moves differ.
Input
One positive integer $n$.
Output
One integer — the number of ways modulo $10^{9} + 7$.
Note
$1 \le n \le 10^{6}$
Examples
Input #1
3
Output #1
4
Input #2
4
Output #2
7