#K52817. Centered Hexagonal Number

    ID: 29394 Type: Default 1000ms 256MiB

Centered Hexagonal Number

Centered Hexagonal Number

You are given a positive integer \(N\). Your task is to compute the N-th centered hexagonal number modulo \(10^9+7\). The centered hexagonal numbers are defined by the formula:

[ H_{n} = 3n(n-1) + 1 ]

For example:

  • For \(N=1\), \(H_1 = 1\).
  • For \(N=2\), \(H_2 = 3 \times 2 \times 1 + 1 = 7\).

Read the input from standard input and output the answer to standard output.

inputFormat

The input consists of a single line containing one integer \(N\) (\(1 \le N \le 10^6\) or larger) representing the term to compute.

outputFormat

Output a single integer: the N-th centered hexagonal number modulo \(10^9+7\).

## sample
1
1