Transition problem

Hey,
What i am trying to achieve is a transition that goes both back and forth.
If you look at my file, if you press 2 the square goes to number 2. How to do, that when you press 3 from 1 it goes past 2. And if you press from 4 to 1 it goes back on the timeline?
hope you understand
thx