How to correctly transfer the code from the blueprint to the material?

Greetings!
Help transfer the blueprint code to the material!
The code is a conversion of the hsi color model to rgb.
This is the working code in the blueprint:

This is my attempt to translate this into materials which is not working correctly!
Please see what I did wrong, conditions, sequence, etc.!:

The problem, it seems to me, is in the conditions!