#K4116. Honeycomb Cells: Counting in Concentric Rings

    ID: 26804 Type: Default 1000ms 256MiB

Honeycomb Cells: Counting in Concentric Rings

Honeycomb Cells: Counting in Concentric Rings

In a hexagonal honeycomb, cells are arranged such that each additional concentric ring adds extra cells around the previous layer. The innermost cell is considered as ring 1. For a given number of rings n, the total number of honeycomb cells can be computed using the formula:

$$T = 1 + 3n(n-1)$$

For example:

  • If n = 1, then T = 1.
  • If n = 2, then T = 7.
  • If n = 3, then T = 19.

Your task is to write a program that reads an integer n from standard input and outputs the total number of cells in the honeycomb.

inputFormat

The input consists of a single integer n (n ≥ 1) representing the number of concentric rings.

outputFormat

Output a single integer, the total number of honeycomb cells calculated using the formula: $$T = 1 + 3n(n-1)$$.## sample

1
1