N = int(input()) print((N*(N+1)/3) %1000000007)