#include <bits/stdc++.h>
using namespace std;
int a[15][15], b[15][15], la[105];
double dp[105];
int main() {
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
      if (i & 1)
        b[i][j] = i * 10 + 9 - j;
      else
        b[i][j] = i * 10 + j;
    }
  }
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
      scanf("%d", &a[i][j]);
      la[b[i][j]] = b[i - a[i][j]][j];
    }
  }
  dp[0] = 0;
  for (int i = 1; i < 6; i++) dp[i] = 6;
  for (int i = 6; i < 100; i++) {
    double sum = 0;
    for (int j = 1; j <= 6; j++) {
      sum += min(dp[i - j], dp[la[i - j]]);
    }
    dp[i] = sum / 6 + 1;
  }
  printf("%6lf\n", dp[99]);
  return 0;
}
