#include <bits/stdc++.h>
using std::min;
const int S = 105, N = 15;
int h[N][N], bh[N][N], pre[S];
double f[S];
int main() {
  int n = 10, cnt = 0;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j) scanf("%d", &h[i][j]);
  for (int i = 0, j = 0, k = 1; i < n; ++i, j -= k, k = -k)
    for (; j < n && j >= 0; j += k) {
      bh[i][j] = ++cnt;
      pre[cnt] = h[i][j] ? bh[i - h[i][j]][j] : 0;
    }
  f[0] = 1e9;
  for (int i = 2; i <= 100; ++i)
    if (i < 7)
      f[i] = 6;
    else {
      for (int j = 1; j < 7; ++j) f[i] += min(f[i - j], f[pre[i - j]]);
      f[i] = f[i] / 6 + 1;
    }
  printf("%lf", f[100]);
  return 0;
}
