uses crt;
var x, y, Z : integer;
begin
clrscr;
write('Nhap x, y = '); readln(x, y);
if x * x + y * y <= 2 then Z := x * x + y * y;
if (x * x + y * y > 2) and (y >= x) then Z := abs(x) + 2 * y;
if (x * x + y * y > 2) and (y < x) then Z := 3;
write('Z = ', Z);
readln
end.