How do I make a code that follows this? `1⋅2+2⋅3+3⋅4+…+(n−1)⋅n`

For example, if `n=5`, the answer is `1⋅2+2⋅3+3⋅4+4⋅5=40.`

`n` cannot be less than or equal to two or more or equal to 1000

This is my code for now but it doesn't work.

```
n = int(input())
if n>= 2 and n<=1000:
    sum = 0;
    numbers = range(1, n+1)
    for amount in numbers:
        if (amount % 2 == 1):
            sum *= amount
        else:
            sum += amount 
    print(sum)

```