Var day: array[1..30] of boolean;
i, pos, tree_height : integer;
Begin
readln(pos, tree_height);
for i := 1 to 30 do
day[i] := (random(100) > 30);
for i := 1 to 30 do begin
if day[i] then pos := pos + 2
else pos := pos - 10;
if pos > tree_height then pos := tree_height;
if pos < 0 then pos := 0;
writeln('День ', i:2, '(', day[i]:5,') pos = ',pos);
end;
writeln(pos);
End.