#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
long long POW(long long a, long long b, long long MMM = MOD) {
  long long ret = 1;
  for (; b; b >>= 1, a = (a * a) % MMM)
    if (b & 1) ret = (ret * a) % MMM;
  return ret;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) {
  if (a == 0 || b == 0) return a + b;
  return a * (b / gcd(a, b));
}
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, 1, -1};
int ddx[] = {2, 2, -2, -2, 1, 1, -1, -1}, ddy[] = {1, -1, 1, -1, 2, -2, 2, -2};
int a[10][10], num[10][10], to[100];
double d[100];
double go(int N) {
  if (N == 99) return 0;
  double &ret = d[N];
  if (ret != -1) return ret;
  ret = 1;
  if (N >= 94) {
    int t = 99 - N;
    for (int(i) = (1); (i) <= (6); (i) += (1))
      if (N + i <= 99) ret += go(N + i) / 6;
    ret = ret * 6 / t;
    return ret;
  }
  for (int(i) = (1); (i) <= (6); (i) += (1)) {
    int next = N + i;
    if (to[next] != -1)
      ret += min(go(next), go(to[next])) / 6;
    else
      ret += go(next) / 6;
  }
  return ret;
}
int main() {
  fill(d, d + 100, -1);
  memset((to), -1, sizeof(to));
  ;
  for (int(i) = (0); (i) <= (9); (i) += (1))
    for (int(j) = (0); (j) <= (9); (j) += (1)) scanf("%d", &a[i][j]);
  for (int(i) = (0); (i) <= (9); (i) += (1))
    for (int(j) = (0); (j) <= (9); (j) += (1)) {
      if (i & 1)
        num[i][j] = (9 - i) * 10 + j;
      else
        num[i][j] = (9 - i) * 10 + (9 - j);
    }
  for (int(i) = (0); (i) <= (9); (i) += (1))
    for (int(j) = (0); (j) <= (9); (j) += (1))
      if (a[i][j]) {
        to[num[i][j]] = num[i - a[i][j]][j];
      }
  printf("%.9f", go(0));
}
