#include <bits/stdc++.h>
const int MAXN = 100;
const int MOD = 1000000007;
int MyGCD(int a, int b) {
  if (b) return MyGCD(b, a % b);
  return a;
}
long long ModPow(long long x, long long y, long long z) {
  x %= z;
  long long ans = 1;
  while (y) {
    if (y & 1) ans = ans * x % z;
    x = x * x % z;
    y >>= 1;
  }
  return ans;
}
class C_Edge {
 public:
  friend bool operator<(const C_Edge &x, const C_Edge &y) {
    return x.cost > y.cost;
  }
  int u, v;
  long long cost;
} tmp, tmp2;
int n;
bool unvis[MAXN];
int MyAbs(const int &x) {
  if (x < 0) return -x;
  return x;
}
std::vector<int> d[MAXN][MAXN];
double dp[MAXN][MAXN], dp6[MAXN][MAXN];
const double INF = 1e10;
int main() {
  int h;
  for (int i = 0; i < 10; ++i)
    for (int j = 0; j < 10; ++j) {
      scanf("%d", &h);
      if (h) d[i - h][j].push_back(h);
      dp[i][j] = INF;
      dp6[i][j] = 0.0;
    }
  bool flag = false;
  dp[0][0] = dp6[0][0] = 0.0;
  for (int i = 0; i < 10; ++i) {
    if (flag) {
      for (int j = 9; ~j; --j) {
        for (int k = 1; k <= 6; ++k) {
          if (j + k > 9)
            dp6[i][j] += dp[i - 1][19 - j - k] + 1.0;
          else
            dp6[i][j] += dp[i][j + k] + 1.0;
        }
        dp6[i][j] /= 6.0;
        dp[i][j] = std::min(dp[i][j], dp6[i][j]);
        for (int k : d[i][j]) {
          dp[i + k][j] = std::min(dp[i + k][j], dp6[i][j]);
        }
      }
    } else {
      for (int j = 0; j < 10; ++j) {
        if (i + j) {
          for (int k = 1; k <= 6; ++k) {
            if (j - k < 0) {
              if (i)
                dp6[i][j] += dp[i - 1][k - j - 1] + 1.0;
              else
                dp6[i][j] += 1.0;
            } else
              dp6[i][j] += dp[i][j - k] + 1.0;
          }
          if (i)
            dp6[i][j] /= 6.0;
          else
            dp6[i][j] /= std::min(6, j);
          dp[i][j] = std::min(dp[i][j], dp6[i][j]);
        }
        for (int k : d[i][j]) {
          dp[i + k][j] = std::min(dp[i + k][j], dp6[i][j]);
        }
      }
    }
    flag = !flag;
  }
  printf("%.10f\n", dp[9][0]);
  return 0;
}
