#abc234a. A - Weird Function

A - Weird Function

Score : 100100 points

问题描述

让我们定义一个函数 ff,其表达式为 f(x)=x2+2x+3f(x) = x^2 + 2x + 3

给定一个整数 tt,求解 f(f(f(t)+t)+f(f(t)))f(f(f(t)+t)+f(f(t))) 的值。

这里保证答案是一个不超过 2×1092 \times 10^9 的整数。

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

Let us define a function ff as f(x)=x2+2x+3f(x) = x^2 + 2x + 3.
Given an integer tt, find f(f(f(t)+t)+f(f(t)))f(f(f(t)+t)+f(f(t))).
Here, it is guaranteed that the answer is an integer not greater than 2×1092 \times 10^9.

Constraints

  • tt is an integer between 00 and 1010 (inclusive).

Input

Input is given from Standard Input in the following format:

tt

Output

Print the answer as an integer.

Sample Input 1

0

Sample Output 1

1371

The answer is computed as follows.

  • $f(t) = t^2 + 2t + 3 = 0 \times 0 + 2 \times 0 + 3 = 3$
  • f(t)+t=3+0=3f(t)+t = 3 + 0 = 3
  • $f(f(t)+t) = f(3) = 3 \times 3 + 2 \times 3 + 3 = 18$
  • f(f(t))=f(3)=18f(f(t)) = f(3) = 18
  • $f(f(f(t)+t)+f(f(t))) = f(18+18) = f(36) = 36 \times 36 + 2 \times 36 + 3 = 1371$

Sample Input 2

3

Sample Output 2

722502

Sample Input 3

10

Sample Output 3

1111355571

update @ 2024/3/10 10:09:46