Twist and whirl - want to cheat

Problem Name:
Twist and whirl - want to cheat
Site:Spoj
Links:
Tags:
Problem setters: