mod = 10 ** 9 + 7 one_third = pow(3, mod - 2, mod) n = int(input()) print(n * (n + 1) * one_third % mod)