문제
Being a fan of contemporary architecture, Farmer John has built a new barn in the shape of a perfect circle. Inside, the barn consists of a ring of
Farmer John owns
To manage the process of herding the cows so that one cow ends up in each room, Farmer John wants to use the following approach: each cow enters at the door at which she initially lined up, then walks clockwise through the rooms until she reaches a suitable destination. Given that a cow walking through
Problem credits: Brian Dean
입력
The first line of input contains
출력
Please write out the minimum amount of energy consumed by the cows.
예제
10
1
0
0
2
0
0
1
2
2
2
33