#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647;
const int N = 10;
int tab[N][N], i, j, k, x, y;
double res[N][N], val;
int main() {
  for (i = 9; i >= 0; i--)
    for (j = 0; j < 10; j++) scanf("%d", &tab[i][j]);
  res[9][0] = 0.0;
  for (j = 1; j <= 9; j++) {
    res[9][j] = 1.0;
    for (k = 1; k <= 6; k++)
      if (j - k >= 0) res[9][j] += 1.0 / 6.0 * res[9][j - k];
    if (j <= 5) res[9][j] *= (6.0 / j);
  }
  for (i = 8; i >= 0; i--) {
    if (i % 2 == 1)
      for (j = 0; j <= 9; j++) {
        res[i][j] = 1.0;
        for (k = 1; k <= 6; k++) {
          x = i;
          y = j - k;
          if (y < 0) {
            x++;
            y = -(y + 1);
          }
          val = min(res[x][y], res[x + tab[x][y]][y]);
          res[i][j] += 1.0 / 6.0 * val;
        }
      }
    if (i % 2 == 0)
      for (j = 9; j >= 0; j--) {
        res[i][j] = 1.0;
        for (k = 1; k <= 6; k++) {
          x = i;
          y = j + k;
          if (y > 9) {
            x++;
            y = 19 - y;
          }
          val = min(res[x][y], res[x + tab[x][y]][y]);
          res[i][j] += 1.0 / 6.0 * val;
        }
      }
  }
  printf("%.9lf\n", res[0][0]);
  return 0;
}
