Solution for sum