12411 - Big Number Multiplication   

Description

related problem: 11112-Big Number

Hey, do you want to hear something amazing? Square of a 16-digit integer can be larger that the maximum of long long int.

Given a 16-digit integer n with no trailing zeros, please output the result of n*n.

Hint and Suggested Implementation

How to represent an integer that is too long to be stored in either int or long long int?

A simple and intuitive method is to use a string ( char array ). Addition and Multiplication can be implemented using 直式 , for example :

Another method is to use an int array. An integer can be sliced up to several 4-digit numbers, with each of them stored in array. Addition and Multiplication can be implemented using 直式 as well, for example :

From another point of view, the first method (using char array) is to implement big number multiplication under base 10 system, while the second method (using int array, with each array element storing a 4-digit number) is to implement big number multiplication under base 10000 multiplication.

Below is a suggested way to implement big number multiplication using the second method. For this problem, you can either fill in the ??? in the code below, or feel free to write your own version of big number multiplication.

Input

A 16-digit integer n with no trailing zeros. In other words, (10^15) <= n <= (10^16)-1.

Output

The result of n*n. There should be a new line character in the end, and the output format is always 32-digit wide with space prepended if needed.

 

Sample Input  Download

Sample Output  Download

Tags




Discuss