Олимпиадный тренинг

Задача 38681. Triangle


Задача

Темы:
If you draw a regular triangle with side n and divide it into regular triangles with side 1, you get n2 small triangles.
For example, with n = 3 (see the figure), you will get 9 small triangles.

And what will be the length of all the lines drawn in this case? For example, with n = 3, the length of all lines is equal to 18.
The answer to this problem is some expression that can contain integers, the variable n, the operations of addition (denoted by "+", subtraction (denoted by "−"), multiplication (denoted by "*") ), divisions (denoted by «/»), and parentheses to change the order of actions.
An entry like "2n" to indicate the product of the number 2 and the variable n is incorrect, you need to write "2 * n". An expression like "n2" must be written using the multiplication operation: «n * n».
Your expression must give the correct answer for any n, for example, for n = 3, the value of expression must be equal to 18.
An example of the correct form for writing a response:
(n + 1) * (n - 2) / 2

Запрещенные операторы:if