The performer Turtle acts on a plane with a Cartesian coordinate system. At the initial moment, the Turtle is at the origin of coordinates, its head is directed along the positive direction of the y-axis, the tail is lowered. With the tail lowered, the Turtle leaves a trail in the form of a line on the field. At each specific moment, the position of the performer and the direction of his movement are known.
The performer has commands:
Forward n
and
Back n
(where
n
– is an integer), causing the Turtle to move by
n code> units in the corresponding direction; Right m
and Left m
(where m
– is an integer) causing the direction to change to m code> degrees clockwise or counterclockwise, respectively; Raise tail
, indicating the transition to move without drawing; Lower tail
, indicating the transition to paint mode.
Recording
Repeat k [Command1 Command2 … CommandS]
means that the sequence of S
commands will be repeated k
times.
The turtle was given the following algorithm to execute:
Repeat 4 [Forward 8 Right 90 Forward 9 Right 90]
Raise your tail
Forward 2 Right 90 Forward 4 Left 90
Lower your tail
Repeat 8[Forward 10 Left 90]
Determine how many points with integer coordinates will be inside the intersection of shapes bounded by the lines specified by the algorithm, including points on the boundaries of this intersection: