A particle sits at the centre of square a1 (marked S) on a 6 x 6 board. It wants to reach the centre of square f6 (marked T). Columns are labelled a to f from left to right, and rows 1 to 6 from bottom to top. There are five posts (#), at a5, e1, e3, e4 and f1:
6 . . . . . T
5 # . . . . .
4 . . . . # .
3 . . . . # .
2 . . . . . .
1 S . . . # #
a b c d e f
Posts are points of zero width at the centres of their squares. The particle moves by a series of swings. Each swing works like this:
- Toss. The particle ties its rope to a post it can see. A post is visible if no other post lies on the straight segment between the particle and that post.
- Swing. The particle picks a direction, clockwise or counter-clockwise, and rotates about the post with the rope held taut.
- It must stay within the board. It may touch the outer edge of the board (half a square beyond the centres of the outermost squares) but may not cross it.
- The particle may not pass through a post: if the particle itself would run into a post, the swing must end at or before that point.
- If the moving rope sweeps into another post that is closer to the pivot than the particle, the rope bends around that post. That post becomes the new pivot, the free rope becomes shorter by the distance between the two pivots, and the rotation carries on in the same direction. If the rope sweeps into several such posts at the same moment (they lie on one line through the pivot), it bends around the farthest of them. Bending can happen more than once, and the rope may cross itself.
- Stop. The particle may end the swing (stopping early if it likes) at the centre of any post-free square it reaches during the swing. This includes a square it occupies at the exact moment the rope touches a post.
- Cost. The swing costs 1/D², where D is the length of the rope when it is tossed: the distance from the particle to the post, measured in square widths.
The total cost of a route is the sum of the costs of its swings.
Find the minimum total cost to get from a1 to f6.
Answer format: give the minimum cost as an exact fraction in lowest terms.