Beginner's Spoon

0

0 votes
Easy-Medium
Problem

After having a great start in the world of coding, you now have a challenge in front of you to show others that you are better than them. But for that you need to solve my problem.

I am a man who loves numbers. Your tasks are as follows:-

  • Generate a Fibonacci series up to the specified number(N)
  • Generate a sequence up to the specified number. (ie. 0-N)

Your task is to remove the Fibonacci series from the sequence and find the factorial of the remaining numbers. Your final move would be to show the show the sum of all the factorials MOD 10^9 + 7.

Check the explanation for better understanding.

CONSTRAINT:

0<=N<=100000

INPUT FORMAT:

Input will be just a single number 'N'

OUTPUT FORMAT:

Print a single number showing the sum of the factorials MOD 10^9 +7 .

SAMPLE INPUT:

9

SAMPLE OUTPUT:

368664

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

Let N be 9

Fibonacci Series : 0 1 1 2 3 5 8

Sequence: 0 1 2 3 4 5 6 7 8 9

After removing Fibonacci series from the sequence, you are left with : 4 6 7 9

Now find the factorial of the remaining numbers (ie. 4,6,7,9) and finally print their sum % 10^9 +7

If you can pass my problem, you rock

Editor Image

?