#include <bits/stdc++.h>
using namespace std;
const int maxn = 100 + 7;
const double inf = 1e100;
int id[maxn][maxn];
int doto[maxn];
double ans[maxn];
int main() {
  int n = 10;
  int tot = 0;
  for (int i = 0; i < n; i++) {
    if (i & 1) {
      for (int j = n - 1; j >= 0; j--) id[i][j] = tot++;
    } else {
      for (int j = 0; j < n; j++) id[i][j] = tot++;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      int up;
      scanf("%d", &up);
      doto[id[i][j]] = id[i - up][j];
    }
  }
  int m = 100;
  ans[0] = 0;
  for (int i = 1; i <= 5; i++) ans[i] = 6;
  for (int i = 6; i < m; i++) {
    for (int j = 1; j <= 6; j++) {
      ans[i] += min(ans[i - j], ans[doto[i - j]]);
    }
    ans[i] = ans[i] / 6 + 1;
  }
  printf("%.10f\n", ans[m - 1]);
  return 0;
}
