valid number

the trick is when entering a new state, we need to make sure what is the previous state so that we know what the next state would be