AlgoUniversity
  • Go Back
Discussion
A Game Of Cricket :

Author

Yash Sahijwani

Difficulty Level : Easy

Submissions : 478

Asked In : Salesforce

Marks :10

: 7 | : 1

In the game of cricket, players can score runs by hitting the ball delivered at them(by another player called bowler) and running between designated spots(wickets).

Suppose if a player is only allowed to score 1,2,4 and 6 runs in a ball. How many ways can the player score $$$N$$$ runs without hitting consecutive 4s?

Print the answer modulo $$$10^9+7$$$.

Input

The first line of input consists of a single integer $$$N$$$ - the number of runs to be scored. $$$(1 \leq N \leq 10^6)$$$

Output

The output consists of a single integer - the number of ways $$$N$$$ runs can be scored without hitting consecutive 4s. Print the answer modulo $$$10^9+7$$$

Example

Input
6
Output
19

You need to login to view your submissions.

You need to login to view all submissions.

Loading...

Result : Executed

Loading...

Feel something is wrong with the test cases?

Result : Accepted

Test Cases :

You need to Log In
We're glad that you want to attempt this problem!

But to Run or Submit the Problem, you need to Log In.

Continue to Log In
Challenge Submitted!

Your challenge has been submitted successfully.

You will get a response soon via WhatsApp or Email.

Challenge
Facing issue while trying to solve the problem! Don't worry, we got you covered!

Do let us know your issue.

Looks good!
Please enter your issue / feedback.

How do we get in touch with you?
Looks good!
Please enter your phone no.
Looks good!
Please enter your email address.