Solve SumOfPower