Solution to sum_time