#include <bits/stdc++.h>
using namespace std;
double dp[1000], vs;
int de[110][110], q;
int laa[110000];
int main() {
  for (int x = 0; x < 10; x++) {
    for (int y = 0; y < 10; y++) {
      if (x % 2) {
        de[x][y] = (x * 10 + 9 - y);
      } else {
        de[x][y] = (x * 10 + y);
      }
    }
  }
  for (int x = 0; x < 10; x++) {
    for (int y = 0; y < 10; y++) {
      scanf("%d", &q);
      laa[de[x][y]] = de[x - q][y];
    }
  }
  for (int x = 1; x < 6; x++) {
    dp[x] = 6.0;
  }
  for (int x = 6; x < 100; x++) {
    vs = 0;
    for (int y = 1; y <= 6; y++) {
      vs += min(dp[x - y], dp[laa[x - y]]);
    }
    dp[x] = (vs / 6.0) + 1.0;
  }
  printf("%.6lf", dp[99]);
}
