Problems
313 - Simply Square Again
SUBMIT PROBLEM

Simply Square Again

Time Limit: 1 sec

 

The Problem

Squaring is the simplest thing of math. It’s a simple multiplication. A number, a and some instructions will be given and you have to solve the problem by following those instructions.

 

 

Step 1: Squaring the given number such as: 

If a = 32

322

= 1024

Step 2: Add all the digits of the answer

1 + 0 + 2 + 4

= 7

Step 3: Square the answer

72 

= 49

Step 4: Subtract step 3’s answer from step 1

1024 – 49

= 975

Step 5: Square the answer

9752

= 950625

Step 6: Print the value of 1’s digit

5

 

 

The Input

Input file contains a series of line. Each line contains a single integer a (32<=a<=99). Input is terminated by EOF

 

The Output

For each line of input output will show the 1’s digit of the answer in a separate line.

 

Sample Input

 32

 40

 50

 60

 65

 70

 99

 

Sample Output

5

1

1

1

6

1

9

 

 

 

 

 

Problem Setter: Samia Safa Ahmed