n = int(input()) print(round((n - 1) * (n - 1) / 12) % 1000000007)