A box contains a number of choclates that can only br removed 1 at a time or 3 at a time .How many ways can the box be emptied?the answer can be very large so return it as modulo of 10^9+7.
for example,there are n=7 choclates initially.They can be removed nine ways,as follows:
1.(1,1,1,1,1,1,1)
2.(1.1.1.1.3)
3.(1,1,1,3,1)
4.(1,1,3,1,1)
5.(1,3,1,1,1)
6.(3,1,1,1,1)
7.(1,3,3)
8.(3,1,3)
9.(3,3,1)
Function Description
Complete the function numberofWays in the editor.The function must return an integer which denotes the number of ways to empty the box.
numberofWays has the following parameter:
n: an integer
constraints
. 1<=n<=10^8
Sample test Case :
Input: 1
Sample OutPut: 1
Explanation: 1
There is only 1 way to move 1 choclate. Answer=(1%1000000007)=1