#include <bits/stdc++.h>
using namespace std;
int a[12][12], nxt[110];
int id(int x, int y) {
  if (x & 1) return (10 - x) * 10 + 11 - y;
  return (10 - x) * 10 + y;
}
double dp[120];
int main() {
  for (int i = 1; i <= 10; i++)
    for (int j = 1; j <= 10; j++) a[i][j] = id(i, j);
  for (int i = 1; i <= 10; i++) {
    for (int j = 1, k; j <= 10; j++) {
      scanf("%d", &k);
      nxt[a[i][j]] = a[i - k][j];
    }
  }
  for (int i = 1; i < 6; i++) dp[100 - i] = 6;
  for (int i = 94; i; i--) {
    double x = 0;
    for (int j = 1; j <= 6; j++) {
      x += min(dp[i + j], dp[nxt[i + j]]);
    }
    dp[i] = x / 6 + 1;
  }
  printf("%.10f\n", dp[1]);
}
