#include <bits/stdc++.h>
using namespace std;
int read() {
  int xx = 0, ff = 1;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') ff = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    xx = xx * 10 + ch - '0';
    ch = getchar();
  }
  return xx * ff;
}
long long READ() {
  long long xx = 0, ff = 1;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') ff = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    xx = xx * 10 + ch - '0';
    ch = getchar();
  }
  return xx * ff;
}
char one() {
  char ch = getchar();
  while (ch == ' ' || ch == '\n') ch = getchar();
  return ch;
}
int mp[11][11], id[11][11], lad[110];
pair<int, int> pos[110];
double f[110];
int main() {
  for (int i = 1; i <= 10; i++)
    for (int j = 1; j <= 10; j++) {
      mp[i][j] = read();
      if (i & 1)
        id[i][j] = (i - 1) * 10 + j;
      else
        id[i][j] = (i - 1) * 10 + 11 - j;
      pos[id[i][j]] = make_pair(i, j);
      if (mp[i][j]) lad[id[i][j]] = id[i - mp[i][j]][j];
    }
  f[0] = 1e9;
  f[1] = 0;
  for (int i = 2; i <= 100; i++) {
    int deg = 0;
    f[i] = 6;
    for (int j = 1; j <= 6; j++) {
      if (i <= j) break;
      f[i] += (min(f[i - j], f[lad[i - j]]));
      deg++;
    }
    f[i] /= deg;
  }
  printf("%.7lf\n", f[100]);
  return 0;
}
