<p>Given <code>n</code> orders, each order consists of a pickup and a delivery service.</p>

<p>Count all valid pickup/delivery possible sequences such that delivery(i) is always after of&nbsp;pickup(i).&nbsp;</p>

<p>Since the answer&nbsp;may be too large,&nbsp;return it modulo&nbsp;10^9 + 7.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>

<pre>
<strong>Input:</strong> n = 1
<strong>Output:</strong> 1
<strong>Explanation:</strong> Unique order (P1, D1), Delivery 1 always is after of Pickup 1.
</pre>

<p><strong class="example">Example 2:</strong></p>

<pre>
<strong>Input:</strong> n = 2
<strong>Output:</strong> 6
<strong>Explanation:</strong> All possible orders: 
(P1,P2,D1,D2), (P1,P2,D2,D1), (P1,D1,P2,D2), (P2,P1,D1,D2), (P2,P1,D2,D1) and (P2,D2,P1,D1).
This is an invalid order (P1,D2,P2,D1) because Pickup 2 is after of Delivery 2.
</pre>

<p><strong class="example">Example 3:</strong></p>

<pre>
<strong>Input:</strong> n = 3
<strong>Output:</strong> 90
</pre>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>1 &lt;= n &lt;= 500</code></li>
</ul>

class Solution {
public:
    long long mod = 1e9 + 7;
    
    long long countWays(int n, std::vector<long long>& dp) {
        if (n == 0) return 1;  // Base case: 1 way for no pickup and delivery
        if (dp[n] != -1) return dp[n];  // Return if already computed
        
        // Recursive formula: f(n) = (2n-1) * n * f(n-1)
        long long ways = (countWays(n-1, dp) * (2 * n - 1) % mod * n % mod) % mod;
        return dp[n] = ways;  // Store the result in dp array
    }
    
    int countOrders(int n) {
        std::vector<long long> dp(n + 1, -1);  // Initialize memoization table
        return countWays(n, dp);  // Start solving from n pairs
    }
};



/* class Solution {
public:
    int MOD = 1e9+7;
    int countOrders(int n) {
        if(n==1){
            return 1;
        }
        long long result = 1;
        for(int i=2;i<=n;i++){

            int spaces = 2*(i-1)+1;
            int poss = (spaces * (spaces+1))/2;

            result *= poss;

            result %= MOD;
            
        }

        return result;
    }
}; */
7900