num_of_pegs = int(input())
print(f'{(num_of_pegs * pow(2, num_of_pegs - 3)) % 1000000007}')