Computing sums of radicals in polynomial time