Time limit
1s
Memory limit
128 MB
There is a rectangular grid containing 3 x N points. Each point in the grid can be connected to up to 8 neighboring points around it.

Count how many polygons can be made by connecting points on the grid. A polygon must satisfy all of the following conditions.
The picture below shows two possible polygons when N = 6.

Given N, write a program that computes the number of polygons that can be made.
The first line contains a positive integer N. (N <= 1,000,000,000)
Print the number of polygons that can be made, modulo 1,000,000,000.