#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int SUM = 0, ff = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') ff = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    SUM = (SUM << 3) + (SUM << 1) + (ch ^ 48);
    ch = getchar();
  }
  return SUM * ff;
}
const int N = 13;
int grid[N][N];
int nxt[N][N];
int id[N * N];
double dp[N * N];
int main() {
  for (int i = 0; i < 10; i++)
    for (int j = 0; j < 10; j++) grid[i][j] = read();
  for (int i = 0; i < 10; i++)
    for (int j = 0; j < 10; j++)
      nxt[i][j] = (9 - i) * 10 + ((i & 1) ? j : 9 - j);
  int d = 1, x = 9, y = 0;
  for (int i = 0; i < 100; i++) {
    id[i] = nxt[x - grid[x][y]][y];
    if (y + d == -1 || y + d == 10) {
      d *= -1;
      x--;
    } else {
      y += d;
    }
  }
  dp[99] = 0;
  for (int i = 98; i >= 0; i--) {
    dp[i] = 1;
    int c = 6;
    for (int r = 1; r <= 6; r++) {
      if (i + r >= 100) continue;
      dp[i] += min(dp[i + r], dp[id[i + r]]) / 6;
      c--;
    }
    dp[i] = 6 * dp[i] / (6 - c);
  }
  printf("%.10lf\n", dp[0]);
  return 0;
}
