#include <bits/stdc++.h>
using namespace std;
int h[101][101];
double dp[101][101];
int n;
pair<int, int> pro(int i, int j, int k) {
  if (i % 2 == 1) {
    j += k;
    if (j > 9) {
      j = 9 - (j % 10);
      i--;
    }
  } else {
    j -= k;
    if (j < 0) {
      j = -j - 1;
      i--;
    }
  }
  return {i, j};
}
double f(int i, int j) {
  if (i == 0 && j == 0) return 0;
  if (dp[i][j] > -0.5) return dp[i][j];
  double res = 0;
  for (int k = 6; k >= 1; k--) {
    pair<int, int> go = pro(i, j, k);
    if (h[go.first][go.second] == 0) {
      res += (1 + f(go.first, go.second)) * 1.0 / 6.0;
    } else {
      int h1 = h[go.first][go.second];
      res += (1 + min(f(go.first, go.second), f(go.first - h1, go.second))) *
             1.0 / 6.0;
    }
  }
  return dp[i][j] = res;
}
int main() {
  n = 10;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> h[i][j];
      dp[i][j] = -1;
      dp[i][j] = -1;
    }
  }
  dp[0][0] = 0;
  dp[0][0] = 0;
  for (int j = 1; j < 6; j++) {
    double rem = 1;
    dp[0][j] = 0;
    dp[0][j] = 0;
    for (int i = 0; i < j; i++) {
      dp[0][j] += 1.0 / 6.0 * (1.0 + f(0, i));
      rem -= 1.0 / 6;
    }
    dp[0][j] += rem;
    dp[0][j] /= 1 - rem;
  }
  cout << fixed << setprecision(10) << f(9, 0) << endl;
  return 0;
}
