Adding triplets program