Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/kombinatorika-uch-rangli-bayroq

Three-stripe flags

Easy 1000 ms 128 MB 25%
Share

A flag consists of three horizontal stripes. Each stripe is painted in one of $k$ colors; adjacent stripes must have different colors, while the top and bottom stripes may have the same color. How many different flags can be made?

Three-stripe flags: adjacent stripes have different colors

Input

One positive integer $k$.

Output

One integer — the number of flags.

Note

$1 \le k \le 10^{6}$

Examples

Input #1
3
Output #1
12
Input #2
1
Output #2
0

Sign in to submit a solution

Signing up is free and takes a minute.