题目描述
Given a series of numbers 0 1 4 18 96 600 4320 …., and series starting from zeroth term. Given n, find the nth value of the series.
Example 1:
Input: n = 4
Output: 96
Example 2:
Input: n = 2
Output: 4
Your Task:
You don't need to read or print anything, Your task is to complete the function NthTerm() which takes n as input parameter and returns the nth value of the given series modulo 10^{9} + 7.
Expected Time Complexity: O(n)
Expected Space Complexity: O(1)
Constraints:
1 <= n <= 10000
输入格式
见题面
输出格式
见题面
样例输入
n = 4
样例输出
96