Bessie the cow loves grass, and she is in a hurry to reach the barn for her evening milking. Her pasture is a rectangular grid of $R$ rows ($1 \le R \le 100$) and $C$ columns ($1 \le C \le 100$). Each square is either grass or rock: Bessie cannot eat rock and refuses to step onto a rock square.
Bessie starts on her own square, marked C (for cow), and wants to reach the barn at row 1, column 1, marked B, by the shortest possible route. On each step she moves to one of the up to four orthogonally adjacent squares (up, down, left, or right).
As she walks her shortest route she munches the grass on every square she passes through. She does not eat on the barn's square (there is no grass there), but she does eat the grass on her own starting square.
The picture below shows the map (rock *, grass ., the barn B, and Bessie C at row 5, column 6) beside the same map with one optimal route marked by munches (m):
Map Optimal Munched Route
1 2 3 4 5 6 <-col 1 2 3 4 5 6 <-col
1 B . . . * . 1 B m m m * .
2 . . * . . . 2 . . * m m m
3 . * * . * . 3 . * * . * m
4 . . * * * . 4 . . * * * m
5 * . . * . C 5 * . . * . m
Along this route Bessie munches 9 squares.
Given the map, determine how many squares of grass Bessie eats on her shortest route to the barn.
B for the barn, C for Bessie, . for grass, and * for rock.