#include <bits/stdc++.h>
using namespace std;
const int order[10][10] = {
    {99, 98, 97, 96, 95, 94, 93, 92, 91, 90},
    {80, 81, 82, 83, 84, 85, 86, 87, 88, 89},
    {79, 78, 77, 76, 75, 74, 73, 72, 71, 70},
    {60, 61, 62, 63, 64, 65, 66, 67, 68, 69},
    {59, 58, 57, 56, 55, 54, 53, 52, 51, 50},
    {40, 41, 42, 43, 44, 45, 46, 47, 48, 49},
    {39, 38, 37, 36, 35, 34, 33, 32, 31, 30},
    {20, 21, 22, 23, 24, 25, 26, 27, 28, 29},
    {19, 18, 17, 16, 15, 14, 13, 12, 11, 10},
    {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
};
int jmp[105];
double dp[105];
double dfs(int x) {
  if (x == 99) {
    return 0.0;
  }
  if (x >= 94) {
    return 6.0;
  }
  if (dp[x] > 0) {
    return dp[x];
  }
  dp[x] = 0;
  for (int i = 1; i <= 6; i++) {
    if (jmp[x + i]) {
      dp[x] += min(dfs(jmp[x + i]), dfs(x + i));
    } else {
      dp[x] += dfs(x + i);
    }
  }
  dp[x] = (dp[x] / 6.0) + 1.0;
  return dp[x];
}
int main() {
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
      int tmp;
      scanf("%d", &tmp);
      if (tmp) {
        jmp[order[i][j]] = order[i - tmp][j];
      }
    }
  }
  for (int i = 0; i < 100; i++) {
    dp[i] = -1;
  }
  printf("%.10f", dfs(0));
  return 0;
}
