Bob is a robot who lives in a two-dimensional world. One day, he decided to go out for a travel. There are two kinds of traveling ways for Bob: to walk forward, and to rotate. When he searched the path with his iPhone 4, he only downloaded part of the data because of the bad signal. The data just indicated a series of directions for rotation. Bob decided to go on his trip according to this data.
Bob got started at the center of the two-dimensional world (at least he thought he did), and began to move forward. He can walk far enough (but he can't stay at the same place, even in starting point) and then stop to rotate according to the data. The paths can get intersected.
However, Bob didn't know whether he could get back home or not. So he turned to you for help.
For example, the data indicates like this:
Move forward (He must move for a distance greater than zero. He must not stay and make the next turning without moving forward. The same goes for the following.)
Turn 120 degrees anti-clockwise
Move forward
Turn 120 degrees clockwise
Move forward
Turn 120 degrees clockwise
Move forward
Bob could walk like the figure shows, and he'll get back home.