Type Point=record
x: integer;
y: integer;
end;
var p1, p2, p3, p4 : Point;
function length(p1, p2 : Point) : real;
begin
length := sqrt(sqr(p1.x - p2.x) + sqr(p1.y - p2.y));
end;
Begin
readln(p1.x, p1.y);
readln(p2.x, p2.y);
readln(p3.x, p3.y);
readln(p4.x, p4.y);
if (length(p1, p2) = length (p3, p4)) and (length(p3, p2) = length (p1, p4)) then
writeln('P = ', abs(2 * (length(p1, p2) + length(p3, p2)) ))
else writeln('No');
End.