G. ReHanoi Towers
time limit per test
1 second
memory limit per test
64 megabytes
input
standard input
output
standard output

Everybody knows the classical puzzle about Hanoi Towers. There are three rods and one of them has n rings in ascending order of radius, the biggest disk is at the bottom, smallest is at the top. The objective of the puzzle is to move all of the rings to another rod in a minimal number of steps and preserve the disk order. During one step you are allowed to move only one ring and smaller radius rings can only be put on top of bigger radius rings.

You are required to solve modified Hanoi Towers puzzle. You have four rods instead of three. All other rules are left unchanged.

Input

A single integer number n — the number of rings on the first rod.

1 ≤ n ≤ 109
Output

The minimal number of steps modulo 109 + 7.

Examples
Input
2
Output
3
Input
8
Output
33