#include <bits/stdc++.h>
using namespace std;
const int N = 20;
static int h[N][N];
static double ans[N][N];
inline void nextTile(int &x, int &y) {
  if (y & 1) {
    if (x == 9)
      y--;
    else
      x++;
  } else {
    (x == 0 ? y : x)--;
  }
}
inline void prevTile(int &x, int &y) {
  if (y & 1) {
    if (x == 0)
      y++;
    else
      x--;
  } else {
    (x == 9 ? y : x)++;
  }
}
int main(int argc, char *argv[]) {
  for (int i = 0; i < 10; i++)
    for (int j = 0; j < 10; j++) scanf("%d", &h[i][j]);
  for (int x = 1, y = 0; y != 10; prevTile(x, y)) {
    double k = 1, s = 0;
    int tx = x, ty = y;
    for (int i = 0; i < 6; i++) {
      nextTile(tx, ty);
      if (ty == -1) {
        k -= (6 - i) / 6.0;
        s += (6 - i) / 6.0;
        break;
      }
      if (h[ty][tx])
        s += (1 + min(ans[ty][tx], ans[ty - h[ty][tx]][tx])) / 6.0;
      else
        s += (1 + ans[ty][tx]) / 6.0;
    }
    ans[y][x] = s / k;
  }
  printf("%.10f\n", ans[9][0]);
  return 0;
}
