
changumangu23
Changu and Mangu are brothers. Changu likes 2
and Mangu likes 3
. They decided to express each number as sum of 2 and 3.
They need your help. They want you to tell them the number of ways of writing a number n
as an ordered sum of 2
s and/or 3
s.
Example
For n = 8
, the output should be changumangu23(n) = 4
.
There are 4
ways to write 8
as an unordered sum of 2
s and/or 3
s:
2 + 2 + 2 + 2
;2 + 3 + 3
;3 + 2 + 3
;3 + 3 + 2
.
Input/Output
-
[execution time limit] 1 seconds
-
[input] integer n
The given number
n
.Constraints:
0 ≤ n < 106
. -
[output] integer
- The number of ways to write
n
as an ordered sum of2
s and/or3
s modulo109 + 7
.
- The number of ways to write
Post Comment