Unable to solve - SUMDIGIT

I am a beginner on CodeChef. I have quite a few submissions on HackerEarth, HackerRank. Recently i moved on to CodeChef. Since I already have some experience coding, I thought of solving the medium level problem in Practise School session. I got stuck with the very first problem that I picked - SUMDIGIT. I got the problem statement, however, while trying to solve, I just can’t figure out the logic. I tried to take help of the editorial section but to no avail, I cannot understand what is going on. I spent like two days to understand on my own and finally decided to ask for help.
I don’t want to give up…
Could you please help me, from where I can find resources which will help me to understand at least what’s in the editorial? Please.
Link to problem
Link to editorial
Sorry, if I sound silly anywhere. ( just a beginner :slight_smile: )