Weird journey

Problem Name:
Weird journey
Site:CodeForces
Links:
Tags:
Problem setters: