for(;$=readline();print(o))for(i in a=$.split(x=_=' '))for(j in s=t='',a)t-=v=a[(j-~i)%a.length],s+=s?_+v:v,t<x&&(x=t,o=s)
Note that non-ascii characters in the above source code will be escaped (such as \x9f).
download
return to the top page