#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void in(T &x) {
  char ch;
  x = 0;
  while (isspace(ch = getchar()))
    ;
  do x = x * 10 + ch - '0';
  while (isdigit(ch = getchar()));
}
const int N = 13;
int h[N][N];
long double f[N][N][2];
void adv(int &x, int &y) {
  if (x & 1) {
    if (y == 1)
      --x;
    else
      --y;
  } else {
    if (y == 10)
      --x;
    else
      ++y;
  }
}
int main() {
  for (int i = 1; i <= 10; i++)
    for (int j = 1; j <= 10; j++) in(h[i][j]);
  for (int i = 1; i <= 10; i++) {
    if (i & 1) {
      int sj = 1;
      if (i == 1) {
        f[1][1][0] = 0;
        sj = 2;
      }
      for (int j = sj; j <= 10; j++) {
        f[i][j][0] = 0;
        if (h[i][j])
          f[i][j][1] = f[i - h[i][j]][j][0];
        else
          f[i][j][1] = 1e12;
        long double sum = 0;
        int x = i, y = j;
        long double kf = 0;
        for (int i = 1; i <= 6; i++) {
          adv(x, y);
          if (x < 1)
            kf += 1.0 / (long double)6.0, sum += 1.0 / (long double)6.0;
          else
            sum += (min(f[x][y][0], f[x][y][1]) + 1.0) / (long double)6.0;
        }
        sum /= (1 - kf);
        f[i][j][0] = sum;
      }
    } else {
      for (int j = 10; j >= 1; j--) {
        f[i][j][0] = 0;
        if (h[i][j])
          f[i][j][1] = f[i - h[i][j]][j][0];
        else
          f[i][j][1] = 1e12;
        long double sum = 0;
        int x = i, y = j;
        long double kf = 0;
        for (int i = 1; i <= 6; i++) {
          adv(x, y);
          if (x < 1)
            kf += 1.0 / (long double)6.0, sum += 1.0 / (long double)6.0;
          else
            sum += (min(f[x][y][0], f[x][y][1]) + 1.0) / (long double)6.0;
        }
        sum /= (1 - kf);
        f[i][j][0] = sum;
      }
    }
  }
  printf("%.12Lf\n", f[10][1][0]);
  return 0;
}
