#include <bits/stdc++.h>
using namespace std;
int cnt = 100;
int a[(15)][(15)], num[(15)][(15)], son[(15) * (15)];
double f[(15) * (15)];
template <typename T>
void read(T& t) {
  t = 0;
  bool fl = true;
  char p = getchar();
  while (!isdigit(p)) {
    if (p == '-') fl = false;
    p = getchar();
  }
  do {
    (t *= 10) += p - 48;
    p = getchar();
  } while (isdigit(p));
  if (!fl) t = -t;
}
int main() {
  for (int i = 1; i <= 10; i++) {
    for (int j = 1; j <= 10; j++) read(a[i][j]);
  }
  for (int i = 1; i <= 10; i++) {
    if (i % 2 == 1) {
      for (int j = 1; j <= 10; j++) {
        num[i][j] = cnt;
        son[cnt--] = num[i - a[i][j]][j];
      }
    } else {
      for (int j = 10; j >= 1; j--) {
        num[i][j] = cnt;
        son[cnt--] = num[i - a[i][j]][j];
      }
    }
  }
  f[100] = 0;
  for (int i = 99; i >= 94; i--) f[i] = 6;
  for (int i = 93; i >= 1; i--) {
    for (int j = 1; j <= 6; j++) {
      f[i] += min(f[i + j], f[son[i + j]]);
    }
    f[i] = f[i] / 6 + 1;
  }
  printf("%.10lf", f[1]);
  return 0;
}
