#agc032f. [agc032_f]One Third

[agc032_f]One Third

Problem Statement

We have a round pizza. Snuke wants to eat one third of it, or something as close as possible to that.

He decides to cut this pizza as follows.

First, he divides the pizza into NN pieces by making NN cuts with a knife. The knife can make a cut along the segment connecting the center of the pizza and some point on the circumference of the pizza. However, he is very poor at handling knives, so the cuts are made at uniformly random angles, independent from each other.

Then, he chooses one or more consecutive pieces so that the total is as close as possible to one third of the pizza, and eat them. (Let the total be x of the pizza. He chooses consecutive pieces so that x1/3|x - 1/3| is minimized.)

Find the expected value of x1/3|x - 1/3|. It can be shown that this value is rational, and we ask you to print it modulo 109+710^9 + 7, as described in Notes.

Notes

When you print a rational number, first write it as a fraction fracyx\\frac{y}{x}, where x,yx, y are integers and xx is not divisible by 109+710^9 + 7 (under the constraints of the problem, such representation is always possible). Then, you need to print the only integer zz between 00 and 109+610^9 + 6, inclusive, that satisfies xzequivypmod109+7xz \\equiv y \\pmod{10^9 + 7}.

Constraints

  • 2leqNleq1062 \\leq N \\leq 10^6

Input

Input is given from Standard Input in the following format:

NN

Output

Print the expected value of x1/3|x - 1/3| modulo 109+710^9 + 7, as described in Notes.


Sample Input 1

2

Sample Output 1

138888890

The expected value is frac536\\frac{5}{36}.


Sample Input 2

3

Sample Output 2

179012347

The expected value is frac11162\\frac{11}{162}.


Sample Input 3

10

Sample Output 3

954859137

Sample Input 4

1000000

Sample Output 4

44679646