#include <bits/stdc++.h>
char cc;
int C;
template <class T>
void read(T &x) {
  x = 0;
  cc = getchar();
  C = 1;
  while (!('0' <= cc && cc <= '9')) {
    if (cc == '-') C = -1;
    cc = getchar();
  }
  while (('0' <= cc && cc <= '9')) {
    x = x * 10 + cc - 48;
    cc = getchar();
  }
  x *= C;
}
using namespace std;
int mp[15][15];
double dp[15][15][2], prev_[10], last;
double calc(int _x, int _y, int d) {
  double _prev[10], stp[12];
  memset(_prev, 0, sizeof(_prev));
  memset(stp, 0, sizeof(stp));
  int _ = _x - d, __ = _y, imdis = (_ - 1) * 10 + __;
  for (int i = 6; i >= 1; --i) {
    if (_ & 1) {
      if (__ == 1)
        --_;
      else
        --__;
    } else {
      if (__ == 10)
        --_;
      else
        ++__;
    }
    _prev[i] = dp[_][__][0];
  }
  return 0;
}
inline double nxt(int _x, int _y, int d) { return dp[_x - d][_y][0]; }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  srand(time(NULL));
  for (int i = 1; i <= 10; ++i)
    for (int j = 1; j <= 10; ++j) read(mp[i][j]), dp[i][j][1] = 100;
  int node_x = 1, node_y = 1;
  prev_[1] = 0;
  last = 1;
  dp[1][1][0] = 0;
  for (;;) {
    if (node_x & 1) {
      if (node_y == 10)
        ++node_x;
      else
        ++node_y;
    } else {
      if (node_y == 1)
        ++node_x;
      else
        --node_y;
    }
    if (last < 6) {
      for (int i = 1; i <= last; ++i) dp[node_x][node_y][0] += prev_[i] / 6.0;
      dp[node_x][node_y][0] += 1;
      dp[node_x][node_y][0] /= (last / 6.0);
      ++last;
      for (int i = last; i >= 2; --i) prev_[i] = prev_[i - 1];
      prev_[1] = dp[node_x][node_y][0];
    } else {
      for (int i = 1; i <= 6; ++i) dp[node_x][node_y][0] += prev_[i];
      dp[node_x][node_y][0] /= 6.0;
      dp[node_x][node_y][0] += 1.0;
      for (int i = 6; i >= 2; --i) prev_[i] = prev_[i - 1];
      if (mp[node_x][node_y])
        dp[node_x][node_y][1] = nxt(node_x, node_y, mp[node_x][node_y]);
      prev_[1] = min(dp[node_x][node_y][0], dp[node_x][node_y][1]);
    }
    if (node_x == 10 && node_y == 1) break;
  }
  printf("%.10lf\n", min(dp[10][1][0], dp[10][1][1]));
  return 0;
}
