#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> add_pair(pair<long long, long long> a,
                                    pair<long long, long long> b) {
  return make_pair(a.first + b.first, a.second + b.second);
}
long long power(long long a, long long b) {
  long long res = 1;
  a = a % 1000000007;
  while (b > 0) {
    if (b & 1) {
      res = (res * a) % 1000000007;
      b--;
    }
    a = (a * a) % 1000000007;
    b >>= 1;
  }
  return res;
}
long long fermat_inv(long long y) { return power(y, 1000000007 - 2); }
long long gcd(long long a, long long b) { return (b == 0) ? a : gcd(b, a % b); }
long long mat[10][10];
double e[10][10];
double solve(long long i, long long j) {
  if (e[i][j] != -1.0) return e[i][j];
  double ee, e1 = 0.0;
  double p = 6.0;
  long long jj, ii, x;
  for (x = (1); x < (7); x += (1)) {
    if (i % 2 == 0) {
      jj = min(9ll, j + x);
      ii = i + ((j + x) > 9);
      if (ii > i) jj = max(0ll, 9 - (x - (9 - j + 1)));
      ee = solve(ii, jj);
      if (ii <= 9 && mat[ii][jj] != 0)
        ee = min(ee, solve(ii + mat[ii][jj], jj));
    } else {
      jj = max(0ll, j - x);
      ii = i + ((j - x) < 0);
      if (ii > i) jj = min(9ll, x - (j + 1));
      ee = solve(ii, jj);
      if (ii <= 9 && mat[ii][jj] != 0)
        ee = min(ee, solve(ii + mat[ii][jj], jj));
    }
    e1 += ee;
  }
  e[i][j] = e1 / p;
  e[i][j]++;
  return e[i][j];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long i, j;
  for (i = (10 - 1); i > (-1); i -= (1)) {
    for (j = (0); j < (10); j += (1)) {
      cin >> mat[i][j];
      e[i][j] = -1.0;
    }
  }
  e[9][0] = 0.0;
  e[9][1] = 6.0;
  e[9][2] = 6.0;
  e[9][3] = 6.0;
  e[9][4] = 6.0;
  e[9][5] = 6.0;
  e[9][6] = 6.0;
  cout << fixed << setprecision(10) << solve(0, 0) << '\n';
  return 0;
}
