Why it is wrong? Pascal.
Program nitochka;
var n,r,i:integer;
x: array [1..100] of real;
y: array [1..100] of real;
s,sg:real;
begin
s:=0;
readln(n,r);
For i:=1 to n do
readln(x[i],y[i]);
sg:=2*pi*r;
For i:=1 to n-1 do s:=s+sqrt(sqr(x[i]-x[i+1])+sqr(y[i]-y[i+1]));
s:=s+sqrt(sqr(x[n]-x[1])+sqr(y[n]-y[1]));
s:=s+sg;
writeln(s:1:2);
end.
The example calculates correct