#include <bits/stdc++.h>
using namespace std;
int h[(10 + 5)][(10 + 5)];
double dp[(10 + 5)][(10 + 5)];
int fx[(10 + 5) * (10 + 5)], fy[(10 + 5) * (10 + 5)];
int main() {
  for (int i = 0; i < 10; ++i) {
    for (int j = 0; j < 10; ++j) {
      cin >> h[i][j];
    }
  }
  int x = 0, y = 1;
  fx[0] = 0, fy[0] = 0;
  for (int s = 1; s < 100; ++s) {
    fx[s] = x, fy[s] = y;
    double cnt = 6, E = 1;
    for (int fr = s - 1; ~fr && s - fr <= 6; --fr) {
      cnt--;
      E += min(dp[fx[fr]][fy[fr]], dp[fx[fr] - h[fx[fr]][fy[fr]]][fy[fr]]) / 6;
    }
    dp[x][y] = 6 * E / (6 - cnt);
    if (x & 1) {
      if (y == 0)
        ++x;
      else
        --y;
    } else {
      if (y == 9)
        ++x;
      else
        ++y;
    }
  }
  printf("%.9lf", dp[9][0]);
  return 0;
}
