#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int f = 1, ans = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    ans = ans * 10 + c - '0';
    c = getchar();
  }
  return f * ans;
}
const int N = 11;
int M[N][N], fro[N * N];
double f[N * N];
int main() {
  for (int i = 1; i <= 10; i++)
    for (int j = 1; j <= 10; j++) {
      if (i & 1)
        M[i][j] = (i - 1) * 10 + j;
      else
        M[i][j] = (i - 1) * 10 + 11 - j;
    }
  double sum = 0;
  f[1] = 0;
  for (int i = 2; i <= 6; i++) {
    f[i] = (sum + 6) / (i - 1);
    sum += f[i];
  }
  for (int i = 1; i <= 10; i++) {
    for (int j = 1; j <= 10; j++) {
      int x = read();
      fro[M[i][j]] = M[i - x][j];
    }
  }
  for (int i = 7; i <= 100; i++) {
    double s = 0;
    for (int j = 1; j <= 6; j++) s += min(f[i - j], f[fro[i - j]]);
    f[i] = s / 6.0 + 1;
  }
  printf("%.10lf\n", f[100]);
  return 0;
}
