Bessie and the rest of Farmer John's cows are taking a trip this winter to go skiing. One day Bessie finds herself at the top left corner of an by grid of elevations . In order to join FJ and the other cows at a discow party, she must get down to the bottom right corner as quickly as she can by travelling only north, south, east, and west. Bessie starts out travelling at a initial speed . She has discovered a remarkable relationship between her speed and her elevation change. When Bessie moves from a location of height to an adjacent location of height , her speed is multiplied by the number . The time it takes Bessie to travel from a location to an adjacent location is the reciprocal of her speed when she is at the first location. Find the both smallest amount of time it will take Bessie to join her cow friends and the number of moves required by the path (a move is a transition from one location to another adjacent location).
Line : Three space-separated integers: , and , which respectively represent Bessie's initial velocity and the number of rows and columns in the grid.
Lines : integers representing the elevation of the corresponding location on the grid.
第一行: 个用空格隔开的整数 ,分别表示贝茜的初速度和区域的长度和宽度。
第二到 行:以矩阵的形式表示该区域中各块的高度。
输出格式
A single number value, printed to two exactly decimal places: the minimum amount of time that Bessie can take to reach the bottom right corner of the grid.
输出一个实数(保留 位小数),表示贝茜达到目的地最少需要的时间。