#include <bits/stdc++.h>
using namespace std;
const double pre[7] = {0, 30, 6, 2, 0.75, 0.24, 0};
int M[11][11], n, vis[11][11];
double f[11][11];
void getnxt(int& nx, int& ny, const int& x, const int& y, const int& w) {
  nx = x;
  if (x & 1) {
    ny = y - w;
    if (ny <= 0) ny = 1 - ny, nx = x - 1;
  } else {
    ny = y + w;
    if (ny > n) ny = n - (ny - n) + 1, nx = x - 1;
  }
}
double dp(const int& x, const int& y) {
  if (x == 1 && y == 1) return 0;
  if (vis[x][y]) return f[x][y];
  vis[x][y] = 1;
  double& res = f[x][y];
  res = 0;
  int lim = (x == 1 && y <= 6) ? y - 1 : 6;
  for (int i = 1, nx, ny; i <= lim; ++i) {
    getnxt(nx, ny, x, y, i);
    if (M[nx][ny])
      res += min(dp(nx, ny), dp(nx - M[nx][ny], ny));
    else
      res += dp(nx, ny);
  }
  res += 6.0;
  res /= lim;
  return res;
}
int main(void) {
  n = 10;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) scanf("%d", &M[i][j]);
  printf("%.10lf", dp(10, 1));
  return 0;
}
