n = int(input()) c, res = n - 1, 0 for i in range(2, n - 1): c = c * (n - i) // i res += c * (i - 1) * (n - i - 1) print(res % 1000000007)