#include <bits/stdc++.h>
using namespace std;
const int NIL = -1;
template <class T>
inline T mx(T a, T b) {
  return a > b ? a : b;
}
template <class T>
inline T mi(T a, T b) {
  return a < b ? a : b;
}
template <class T>
inline void sw(T &a, T &b) {
  T t = a;
  a = b;
  b = t;
}
template <class T>
inline T mabs(T x) {
  return x < 0 ? -x : x;
}
inline char gc() {
  char ret;
  while ((ret = getchar()) == ' ' || ret == '\n' || ret == '\t')
    ;
  return ret;
}
template <class T>
inline T sq(T x) {
  return x * x;
}
const int lim = 15;
double dp[lim][lim], dp2[lim][lim];
int x[lim * lim], y[lim * lim], cur = 0, f[lim][lim];
inline void st(int cur, int xx, int yy) {
  x[cur] = xx;
  y[cur++] = yy;
}
int main() {
  for (int i = 1; i <= 10; i++)
    for (int j = 1; j <= 10; j++) scanf("%d", &f[i][j]);
  for (int i = 1; i <= 10; i++)
    if (i & 1)
      for (int j = 1; j <= 10; j++) st(cur++, i, j);
    else
      for (int j = 10; j >= 1; j--) st(cur++, i, j);
  assert(cur == 100);
  for (int i = 1; i < 100; i++) {
    double cc = i - mx(0, i - 6);
    for (int j = mx(0, i - 6); j < i; j++)
      dp[x[i]][y[i]] += dp2[x[j]][y[j]] / cc;
    dp[x[i]][y[i]] += 6. / cc;
    dp2[x[i]][y[i]] = mi(dp[x[i]][y[i]], dp[x[i] - f[x[i]][y[i]]][y[i]]);
  }
  printf("%.8f", dp[10][1]);
  return 0;
}
