**Author**: amit_dwivedi

**Prerequisite**: Basic Math

**Difficulty**: Easy

**Editorialist**: amosaidoo2

Basically, given a number A, you are to make a prediction S based on A such that four other numbers in addition to A sum up to S. This is a variant of a popular game math problem. I will give an illustration below.

A = 15, S = 213, B = 9, C = 90 , D = 15, E = 84. What just happened? When A was given, I subtracted 2 from A and appended 2 in front of A. That is my predicted sum. Now I make sure that anytime a value is given I make a prediction such that the sum is 99. So C = 99 - B and E = 99 - D.

Now to our problem, the only different thing is that we only use N perfect numbers. That is a number cant be zero. Meaning, we have to take care of any zero that may occur. If Cheffa tells me 9, 9 - 9 is 0 meaning that I will get WA. What is I added 1 and tell Cheffa 9 - 9 + 1, then I will be correct. This means I will add 1 to C and add 1 to E. This contributes 2 to the total sum, therefore I will add 2 to the total sum S. The algorithm below illustrates this idea:

- Get N from Cheffa
- Get A from Cheffa
- Predict S = (10 ^ N) * 2 + A //This time I donâ€™t subtract 2
- Get B from Cheffa
- Predict C = (10 ^ N) - B
- Get D from Cheffa
- Predict E = (10 ^ N) - D

My Solution: amosaidoo2

Thank you.