HackerEarth Fredo and Sums problem solution - TheCScience