#include <bits/stdc++.h>
using namespace std;
int Number[12][12];
int Next[110];
double dp[110];
int main() {
  for (int i = 1; i <= 10; i++)
    for (int j = 1; j <= 10; j++)
      Number[i][j] = (10 - i) * 10 + (i % 2 == 0 ? j : 11 - j);
  for (int i = 1; i <= 10; i++) {
    for (int j = 1; j <= 10; j++) {
      int x;
      scanf("%d", &x);
      if (x == 0)
        Next[Number[i][j]] = Number[i][j];
      else
        Next[Number[i][j]] = Number[i - x][j];
    }
  }
  dp[100] = 0;
  double c = 1;
  for (int i = 99; i >= 94; i--) {
    dp[i] = (c + 6 - (100 - i)) / (100 - i);
    c += dp[i] + 1;
  }
  for (int i = 93; i >= 1; i--) {
    double temp = 0;
    for (int j = 1; j <= 6; j++) temp += min(dp[i + j], dp[Next[i + j]]);
    dp[i] = temp / 6 + 1;
  }
  printf("%.10f\n", dp[1]);
  return 0;
}
