yukicoder-541

从 Trac 迁移的文章

这是从旧校内 Wiki 迁移的文章,可能存在一些样式问题,您可以向 memset0 反馈。

原文章内容如下:

{{{
#!html
<script type="text/x-mathjax-config">MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}});</script>
<script type="text/javascript" async src="http://10.71.10.90/sfiction/tool/MathJax/MathJax-master/MathJax.js?config=TeX-MML-AM_CHTML"></script>
<style>
.input, pre {
    display: block;
    padding: 9.5px;
    margin: 0 0 10px;
    font-size: 13px;
    line-height: 1.42857143;
    color: #333;
    word-break: break-all;
    word-wrap: break-word;
    background-color: #f5f5f5;
    border: 1px solid #ccc;
    border-radius: 4px;
}
</style>
}}}

== [https://yukicoder.me/problems/no/541 No.541 3 x N グリッド上のサイクルの個数] ==

=== Description ===

{{{
#!html
<p>有下面一个$4$行$N+1$列的格点图。</p>

<img src="http://10.71.10.90/zimpha/images/yukicoder-579.png" />

<p>求图中简单回路的个数$\bmod (10^9+7)$。</p>
}}}

=== Input ===

{{{
#!html
<p class="input">$N$</p>
<p>
$1 \leq N \leq 10^{18}$
</p>
}}}

=== Output ===

{{{
#!html
输出简单回路个数$\bmod (10^9+7)$。
}}}

=== Sample ===

==== Sample 1 ====
输入
{{{
#!html
<pre>
1
</pre>
}}}
输出
{{{
#!html
<pre>
6
</pre>
}}}

==== Sample 2 ====
输入
{{{
#!html
<pre>
20
</pre>
}}}
输出
{{{
#!html
<pre>
324214693
</pre>
}}}

==== Sample 3 ====
输入
{{{
#!html
<pre>
100
</pre>
}}}
输出
{{{
#!html
<pre>
652583913
</pre>
}}}

No.541 3 x N グリッド上のサイクルの個数

Description

有下面一个$4$行$N+1$列的格点图。

求图中简单回路的个数$\bmod (10^9+7)$。

Input

$N$

$1 \leq N \leq 10^{18}$

Output

输出简单回路个数$\bmod (10^9+7)$。

Sample

Sample 1

输入

1

输出

6
Sample 2

输入

20

输出

324214693
Sample 3

输入

100

输出

652583913