The algebra of tertiary cohomology operations