#include <bits/stdc++.h>
using namespace std;
const int maxn = 100 + 100;
double dp[maxn];
int num[maxn][maxn];
int id[maxn][maxn], idd[maxn];
bool vis[maxn][maxn];
const int dir[3][2] = {{0, 1}, {0, -1}, {1, 0}};
bool in(int x, int y) { return x >= 0 && x < 10 && y >= 0 && y < 10; }
void dfs1(int x, int y, int depth) {
  id[x][y] = depth;
  if (x == 9 && y == 0) {
    return;
  }
  for (int i = 0; i < 3; ++i) {
    int xx = x + dir[i][0];
    int yy = y + dir[i][1];
    if (in(xx, yy) && !vis[xx][yy]) {
      vis[xx][yy] = true;
      dfs1(xx, yy, depth + 1);
      return;
    }
  }
}
void dfs2(int x, int y) {
  idd[id[x][y]] = id[x + num[x][y]][y];
  if (x == 9 && y == 0) {
    return;
  }
  for (int i = 0; i < 3; ++i) {
    int xx = x + dir[i][0];
    int yy = y + dir[i][1];
    if (in(xx, yy) && !vis[xx][yy]) {
      vis[xx][yy] = true;
      dfs2(xx, yy);
      return;
    }
  }
}
void Print(int num[maxn][maxn]) {
  for (int i = 0; i < 10; ++i) {
    for (int j = 0; j < 10; ++j) {
      printf("%d ", num[i][j]);
    }
    printf("\n");
  }
}
int main() {
  ios::sync_with_stdio(false);
  dfs1(0, 0, 0);
  for (int i = 0; i < 10; ++i) {
    for (int j = 0; j < 10; ++j) {
      scanf("%d", &num[i][j]);
    }
  }
  for (int i = 0; i < 5; ++i) {
    for (int j = 0; j < 10; ++j) {
      swap(num[i][j], num[9 - i][j]);
    }
  }
  memset(vis, 0, sizeof(vis));
  dfs2(0, 0);
  for (int i = 98; i >= 0; --i) {
    dp[i] = 1;
    int up = min(i + 6, 99);
    for (int j = i + 1; j <= up; ++j) {
      dp[i] += (min(dp[j], dp[idd[j]])) / 6.0;
    }
    dp[i] *= 6.0 / (up - i);
  }
  printf("%.10lf\n", dp[0]);
  return 0;
}
