P25001 [AtCoder] [ARC057C] Square Root
提高+
题目描述

Problem Description

Find the smallest positive integer \( N \) such that the first \( k \) digits of \( \sqrt{N} \) are \( a_1a_2...a_k \).

Here, the first \( k \) digits of \( \sqrt{N} \) refer to the sequence formed by the first \( k \) digits when the decimal representation of \( \sqrt{N} \) is read from the top, excluding leading zeros and the decimal point. For example, the first 5 digits of \( \sqrt{2} \) are \( 14142 \), and the first 6 digits of \( \sqrt{100} \) are \( 100000 \).

Input Format

The input is given from the standard input in the following format:

\( a_1a_2...a_k \)

Output Format

Output the smallest positive integer \( N \) such that the first \( k \) digits of \( \sqrt{N} \) are \( a_1a_2...a_k \) in one line.

Sample Input and Output

Sample Input #1

1414

Sample Output #1

2

Sample Input #2

316

Sample Output #2

10

Sample Input #3

31415926535897932384626433

Sample Output #3

9869604401089358618834491

Notes/Hints

Constraints

  • \( 1 \leq k \leq 1000 \)
  • \( a_1 \neq 0 \)
输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
1414
样例输出
2