a=v1
if a<v2 then a=v2
if a<v3 then a=v3
if a<v4 then a=v4
d=v1
if d>v2 then d=v2
if d>v3 then d=v3
if d>v4 then d=v4
end function