#include <bits/stdc++.h>
using namespace std;
const int N = 10;
int a[N][N];
double Dp[N * N];
int Next[N * N][N];
int Hash(int i, int j) { return i * N + j; }
pair<int, int> DeHash(int v) {
  if (v == -1) return pair<int, int>(-1, -1);
  return pair<int, int>(v / N, v % N);
}
bool InRange(int i, int j) { return 0 <= i && i < N && 0 <= j && j < N; }
bool InRange(int v) {
  pair<int, int> Cur = DeHash(v);
  return InRange(Cur.first, Cur.second);
}
double Rec(int v = Hash(0, 0)) {
  if (v == Hash(N - 1, 0)) return 0.0;
  assert(InRange(v));
  if (Dp[v] == Dp[v]) return Dp[v];
  double Res = 1.0;
  double Same = 0.0;
  double p = 1.0 / 6.0;
  for (int r = 1; r <= 6; r++) {
    if (Next[v][r] == -1) {
      Same += p;
      continue;
    }
    int i = DeHash(Next[v][r]).first;
    int j = DeHash(Next[v][r]).second;
    Res += p * min(Rec(Next[v][r]), Rec(Hash(i + a[i][j], j)));
  }
  Res = Res / (1.0 - Same);
  return Dp[v] = Res;
}
int main() {
  for (int i = N - 1; ~i; --i)
    for (int j = 0; j < N; j++) scanf("%d", &a[i][j]);
  memset(Next, -1, sizeof Next);
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      if (i == N - 1 && j == 0) continue;
      int d = (i & 1 ? -1 : +1);
      if (InRange(i, j + d))
        Next[Hash(i, j)][1] = Hash(i, j + d);
      else
        Next[Hash(i, j)][1] = Hash(i + 1, j);
    }
  }
  for (int k = 2; k < N; k++)
    for (int i = 0; i < N; i++)
      for (int j = 0; j < N; j++)
        if (Next[Hash(i, j)][1] != -1)
          Next[Hash(i, j)][k] = Next[Next[Hash(i, j)][1]][k - 1];
  memset(Dp, -1, sizeof Dp);
  printf("%.10f", Rec());
}
