How to solve this sum