#include <bits/stdc++.h>
using namespace std;
int a[15][15];
double e[15][15];
int main() {
  e[1][1] = 0;
  for (int j = 2; j <= 6; ++j) {
    double s = 0;
    for (int k = 1; k < j; ++k) s += e[1][k];
    e[1][j] = (s / 6.0 + 1) * 6.0 / (j - 1);
  }
  for (int i = 1; i <= 10; ++i)
    for (int j = 1; j <= 10; ++j) scanf("%d", &a[i][j]);
  for (int i = 1; i <= 10; ++i) {
    if (i % 2) {
      for (int j = 1; j <= 10; ++j) {
        if (i == 1 && j <= 6) continue;
        for (int k = 1; k <= 6; ++k) {
          int x1 = i, y1 = j;
          if (x1 % 2 == 1) {
            y1 -= k;
            if (y1 <= 0) y1 = abs(y1 - 1), x1--;
          } else {
            y1 += k;
            if (y1 > 10) y1 = 20 - y1 + 1, x1--;
          }
          e[i][j] += min(e[x1][y1], e[x1 - a[x1][y1]][y1]);
        }
        e[i][j] /= 6.0;
        e[i][j]++;
      }
    } else {
      for (int j = 10; j >= 1; --j) {
        for (int k = 1; k <= 6; ++k) {
          int x1 = i, y1 = j;
          if (x1 % 2 == 1) {
            y1 -= k;
            if (y1 <= 0) y1 = abs(y1 - 1), x1--;
          } else {
            y1 += k;
            if (y1 > 10) y1 = 20 - y1 + 1, x1--;
          }
          e[i][j] += min(e[x1][y1], e[x1 - a[x1][y1]][y1]);
        }
        e[i][j] /= 6.0;
        e[i][j]++;
      }
    }
  }
  printf("%.6f\n", e[10][1]);
  return 0;
}
