P27821 [洛谷] [Information and Future 2018] Christmas Tree
普及-
题目描述

Problem Description

A Christmas tree has \( n \) layers. The first layer from the top has 1 star, the second layer has 2 stars, and so on, arranged in the shape shown in the figure below.

Stars are connected by ropes. Each star in the first, second, ..., \( n-1 \) layers connects to the two nearest stars in the next layer with a segment of rope. Adjacent stars in the last layer are connected by a segment of rope.

Can you calculate how many segments of rope are needed to decorate a large ( \( n \)-layered) Christmas tree?

Input Format

Input consists of a single integer \( n \), the number of layers of the Christmas tree.

Output Format

Output a single integer, representing the number of rope segments in the Christmas tree.

Sample Input and Output

Sample Input #1

2

Sample Output #1

3

Sample Input #2

4

Sample Output #2

15

Notes

Sample Explanation

Sample 1

A 2-layered Christmas tree requires 3 segments of rope.

Sample 2

Refer to the problem figure.

Data Size

All data satisfies \( 1 \leq n \leq 10^3 \).

The original full score for this problem was \( 15 \text{pts} \).

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
2
样例输出
3