Understanding how RNN works with an example