Finished triple_sum. This version assumes unique elements