#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  for (; ch < '0' || ch > '9'; ch = getchar())
    if (ch == '-') f = -1;
  for (; ch >= '0' && ch <= '9'; ch = getchar())
    x = (x << 1) + (x << 3) + ch - '0';
  return x * f;
}
const int N = 82;
int a[N][N];
pair<int, int> nxt[N][N];
double f[N][N];
double dfs(int x, int y) {
  if (x == 1 && y == 1) return 0;
  if (f[x][y] >= 0) return f[x][y];
  f[x][y] = 0;
  int sx = x, sy = y;
  int k = 0;
  for (int i = 1; i <= 6; ++i) {
    if (sx == 1 && sy == 1) {
      k = 7 - i;
      break;
    }
    int nx = nxt[sx][sy].first;
    int ny = nxt[sx][sy].second;
    sx = nx;
    sy = ny;
    if (a[sx][sy])
      f[x][y] += min(dfs(sx - a[sx][sy], sy), dfs(sx, sy));
    else
      f[x][y] += dfs(sx, sy);
  }
  return f[x][y] = (f[x][y] + 6) / (6.0 - k);
}
int main() {
  for (int i = 1; i <= 10; ++i)
    for (int j = 1; j <= 10; ++j) a[i][j] = read(), f[i][j] = -1;
  for (int i = 1; i <= 10; ++i)
    for (int j = 1; j <= 10; ++j)
      if (i & 1) {
        if (j == 1)
          nxt[i][j] = {i - 1, j};
        else
          nxt[i][j] = {i, j - 1};
      } else {
        if (j == 10)
          nxt[i][j] = {i - 1, j};
        else
          nxt[i][j] = {i, j + 1};
      }
  printf("%.8f\n", dfs(10, 1));
  return 0;
}
