AtCoder Beginner Contest 122
D
We Like AGC
AtCoder
⌀ 1533
原题
← C→
翻译中…

Problem Statement

翻译中…

You are given an integer $N$. Find the number of strings of length $N$ that satisfy the following conditions, modulo $10^9+7$:

翻译中…
  • The string does not contain characters other than A, C, G and T.
  • The string does not contain AGC as a substring.
  • The condition above cannot be violated by swapping two adjacent characters once.
翻译中…

Note

翻译中…

A substring of a string $T$ is a string obtained by removing zero or more characters from the beginning and the end of $T$.

翻译中…

For example, the substrings of ATCODER include TCO, AT, CODER, ATCODER and (the empty string), but not AC.

翻译中…

Constraints

翻译中…
  • $3 \leq N \leq 100$
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N

翻译中…

Output

翻译中…

Print the number of strings of length $N$ that satisfy the following conditions, modulo $10^9+7$.

翻译中…

样例

Input #1
3
Output #1
61
There are $4^3 = 64$ strings of length $3$ that do not contain characters other than `A`, `C`, `G` and `T`. Among them, only `AGC`, `ACG` and `GAC` violate the condition, so the answer is $64 - 3 = 61$.
Input #2
4
Output #2
230
Input #3
100
Output #3
388130742
Be sure to print the number of strings modulo $10^9+7$.
题目信息
题号
abc122_d
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。