A particle sits at the centre of square a1 (marked S) on a 7 x 7 board. It wants to reach the centre of square g7 (marked T). Columns are labelled a to g from left to right, and rows 1 to 7 from bottom to top. There are six posts (black dots), at d1, f1, a5, c5, g5 and b6:

7 . . . . . . T
6 . # . . . . .
5 # . # . . . #
4 . . . . . . .
3 . . . . . . .
2 . . . . . . .
1 S . . # . # .
a b c d e f g
Posts are points of zero width at the centres of their squares. Distances are measured in square widths between square centres. The particle moves by a sequence 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 on 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 part of the 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 that 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, that is, the distance from the particle's starting square to the post.
The total cost of a route is the sum of the costs of its swings. A route ends as soon as the particle stops at T.
Find the minimum total cost of a route from a1 to g7.
Answer format: give the minimum cost as an exact fraction in lowest terms.