Plant

题意翻译

## 题目描述 Dwarfs 种了一株非常有意思的植物,这株植物像一个方向向上的三角形。它有一个迷人的特点,那就是在一年后一株方向向上的三角形的植物就会被分成 4 株三角形的植物:它们当中的三株方向是向上的,一株方向是向下的。 又一年之后,每株植物都会分成四个,规则如上。之后的每年都会重复这一过程。下面的图说明了这一发展过程。 ![图](https://cdn.luogu.org/upload/vjudge_pic/CF185A/06a04cdb90280e6ac952fa1883923dcff872c965.png) 请帮助 Dwarfs 算出 $n$ 年后将会有多少个方向向上的三角形。 ## 输入格式 第一行包括一个整数 $ n $ $ (0\leq n\leq 10^{18}) $,即这植株生长的总年份。 注意:c++ 选手请不要用 ```%lld``` 来读取或输出 ```long long``` 类型,cin/cout 或 ```%I64d``` 更好一些。 ## 输出格式 输出一个整数,即 $ n $ 年后向上的三角形的个数,答案对 $10^{9}+7$ 取模。 **PS:可能直译会造成某些地方比较难理解,直接理解成三角形和植物是一个东西就可以了**。

题目描述

Dwarfs have planted a very interesting plant, which is a triangle directed "upwards". This plant has an amusing feature. After one year a triangle plant directed "upwards" divides into four triangle plants: three of them will point "upwards" and one will point "downwards". After another year, each triangle plant divides into four triangle plants: three of them will be directed in the same direction as the parent plant, and one of them will be directed in the opposite direction. Then each year the process repeats. The figure below illustrates this process. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF185A/06a04cdb90280e6ac952fa1883923dcff872c965.png)Help the dwarfs find out how many triangle plants that point "upwards" will be in $ n $ years.

输入输出格式

输入格式


The first line contains a single integer $ n $ $ (0<=n<=10^{18}) $ — the number of full years when the plant grew. Please do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier.

输出格式


Print a single integer — the remainder of dividing the number of plants that will point "upwards" in $ n $ years by $ 1000000007 $ $ (10^{9}+7) $ .

输入输出样例

输入样例 #1

1

输出样例 #1

3

输入样例 #2

2

输出样例 #2

10

说明

The first test sample corresponds to the second triangle on the figure in the statement. The second test sample corresponds to the third one.