I need help writing this logical preset in Cubase for my E-Hi Hat?

-> Note number = 50
-> If CC 4 is between 1 and 31, transpose note number + 4 (from 50 to 54).
-> If CC 4 is between 32 and 63, transpose note number + 5 (from 50 to 55).
-> If CC 4 is between 64 and 95, transpose note number + 6 (from 50 to 56).
-> If CC 4 is between 96 and 127, transpose note number + 7 (from 50 to 57).

What should be the command lines?
This is in order for the Hi Hat Pedal (CC#4) to play different Open Hi Hat samples in Addictive Drums and other drum software (Midi and input transformer). I'm using a TD10. Is there another way around it?