coin sums finally optimized