#include <bits/stdc++.h>
using namespace std;
struct node {
  int x, y;
};
node nxt(node a) {
  if (a.x & 1) {
    a.y--;
    if (!a.y) a.y = 1, a.x--;
  } else {
    a.y++;
    if (a.y > 10) a.y = 10, a.x--;
  }
  return a;
}
int n = 10;
int a[15][15];
double f[15][15];
double dfs(int x, int y) {
  if (x == 1 && y == 1) return 0;
  if (f[x][y] != -1) return f[x][y];
  double res = 0;
  node t = (node){x, y};
  for (int i = 1; i <= 6; i++) {
    if (t.x == 1 && t.y == 1) return f[x][y] = (res + 6.0) / (i - 1);
    t = nxt(t);
    if (a[t.x][t.y])
      res += min(dfs(t.x - a[t.x][t.y], t.y), dfs(t.x, t.y));
    else
      res += dfs(t.x, t.y);
  }
  return f[x][y] = (res / 6.0 + 1);
}
int main() {
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      f[i][j] = -1;
      scanf("%d", &a[i][j]);
    }
  }
  printf("%.10lf", dfs(10, 1));
  return 0;
}
