(function(){ async function t(t,i){ i("Kokkeli v1"); const e=await t();if("ping"==e||"2019-kuurupiilo"!=e)return;const n=(await t()).split(" ").map(t=>+t),o=n[0],s=n[1],r=[],a=[];for(let t=3;t=3,"ez":t<3,nopeus:7,piilossa:0,"päivityksestä":0});const h=a[s-1],u=a.slice(0,3);function c(t,i,e){const n=e/180*Math.PI;let o=t,s=0;for(;i&&s/i<.95;){const e=(i+s)/2,a=t.x+Math.cos(n)*e*t.nopeus|0,h=t.y+Math.sin(n)*e*t.nopeus|0;a<-1100||1100(a-t.x)*(a-t.x)+(h-t.y)*(h-t.y)<(t.r-32)*(t.r-32))?i=e:(o={x:a,y:h},s=e)}return o}function l(t){return t*t}function y(t,i){return t*t+i*i}function f(t,i,e){return function(t,i,e,n,o,s,r){const a=t-n,h=i-o,u=t-s,c=i-r,f=s-n,p=r-o;if(a*f+h*p>=f*f+p*p)return u*u+c*c<=e*e;if(u*-f+c*-p>=f*f+p*p)return a*a+h*h<=e*e;const k=r-o,d=n-s;return l(k*t+d*i+(s*o-r*n))<=l(e)*y(k,d)}(t.x,t.y,t.r,i.x,i.y,e.x,e.y)}function p(t,i,e){let n=0,o=0;for(let s=0;s<360;s+=10){c(t,i,s);n+=r.some(i=>f(i,t,e))?0:1,o+=1}return n/o}function k(t,i){return y(t.x-i.x,t.y-i.y)/968e4}function d(t,i){return Math.abs(y(t,i)-l(400))}function x(t,i){if(t.historia.length<8)return 0;const e=i.x-t.x,n=i.y-t.y,o=t.historia[t.historia.length-8].x-t.x,s=t.historia[t.historia.length-8].y-t.y,r=(e*o+n*s)/Math.hypot(e,n)/Math.hypot(o,s);return r<.3?0:(r-.3)/.7}h.k=a[3],h.historia=[],a.forEach(t=>t.ez==h.ez&&(t.nopeus*=.9));for(let e=h.ez?200:0;;++e){const n=await t();if(!n||"0"==n)break;const o=n.split(" ").map(t=>+t);for(let t=1;t80||!h.k.pl)&&a.forEach(t=>t.pl&&(!h.k.pl||t.elinaikaa80)h.x==h.kX&&h.y==h.kY&&(h.kX=Math.trunc(1080*Math.cos(s+e%357*Math.PI/180)),h.kY=Math.trunc(1080*Math.sin(s+e%357*Math.PI/180)));else if(!h.ez&&h.piilossa>50);else{let t,i;for(let e=0;e<360;e+=5){const n=h.ez?h.k.elinaikaa:h.elinaikaa,o=c(h,n,e),s=(t,i)=>p(t,n,o)+i*k(t,o),r=h.ez?s(h.k,-.05):-(s(u[0],-.05)+s(u[1],-.05)+s(u[2],-.05))+.3*k(h,o)-.3*x(h,o)-.4*(j=o,Math.pow(d(j.x,j.y)/d(1100,1100),3));(!i||r>t)&&(t=r,i=o)}h.kX=i.x,h.kY=i.y}if(i(h.kX+" "+h.kY),e%4800==4799)for(let t of r)t.r=Math.trunc(3*t.r/4),t.r<=8&&(t.r=0)}else i("-800 300")}var j}return"undefined"==typeof window&&async function(){let i=!1,e=[],n=[];const o=t=>{try{process.exit(t)}catch(t){}try{quit(t)}catch(t){}},s=t=>{try{process.stdout.write(t+"\n")}catch(t){}try{print(t)}catch(t){}},r=t=>{n.length?n.shift()(t):e.push(t)},a=()=>{if(!i){try{r(readline())}catch(t){}return e.length?e.shift():new Promise(t=>n.push(t))}};try{require("readline").createInterface({input:process.stdin}).on("line",r).on("close",()=>i=!0)}catch(t){}try{await t(a,s),o(0)}catch(t){s("ERROR: "+t),console.error(t),o(1)}}(),t}())