#include <bits/stdc++.h>
using namespace std;
int num[10][10], lad[150];
double dp[150][2];
vector<int> vec[150];
int main() {
  for (int i = 0; i < 100; i++) dp[i][0] = dp[i][1] = 100;
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
      if (i & 1)
        num[i][j] = (i + 1) * 10 - j - 1;
      else
        num[i][j] = i * 10 + j;
    }
  }
  for (int i = 0; i < 100; i++) {
    for (int j = 1; j <= 6; j++) vec[i + j].push_back(i);
  }
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
      int x;
      scanf("%d", &x);
      if (x || 1) {
        lad[num[i][j]] = num[i - x][j];
      }
    }
  }
  dp[0][0] = 0;
  dp[1][0] = 6;
  dp[2][0] = dp[3][0] = dp[4][0] = dp[5][0] = dp[6][0] = 6;
  for (int i = 7; i <= 99; i++) {
    double sum = 0;
    for (int j = 1; j <= 6; j++) sum += min(dp[i - j][0], dp[lad[i - j]][0]);
    dp[i][0] = sum / 6.0 + 1.0;
  }
  printf("%.9lf\n", min(dp[99][0], dp[99][1]));
}
