Theres no way I'm reading all that but try this:

if (input == 77) ... //Right
if (input == 75) ... //Left
if (input == 80) ... //Down
if (input == 72) ... //Up