MOD = 10**9+7 N = int(input()) print((N*(N+1)*pow(3,MOD-2,MOD))%MOD)