UVa 114 - Simulation Wizardry

114 - Simulation Wizardry

 * http://acm.uva.es/p/v1/114.html

Summary
Simulate a pinball game according to a set of rules.

Explanation
Simulate a pinball game according to a set of rules:
 * 1) If a ball hits a bumper or a wall, turn right 90 degrees.
 * 2) When a ball hits a bumper, add that the point value of the bumper, and subtract the life value.

Input
4 4 0 2 2 2 1 0 3 3 1 0 2 3 1 1 2 3 1 2 2 3 1 3 2 3 1 4 2 3 1 5

Output
0 0 1 2 2 5