#include <bits/stdc++.h>
using namespace std;
const int maxn = 10 + 5;
const int maxm = 600000 + 100;
const int maxt = 3000000 + 100;
const int maxk = 10 + 3;
const int M = 2010;
const long long unit = 1LL;
const int INF = 0x3f3f3f3f;
const long long Inf = 0x3f3f3f3f3f3f3f3fLL;
const double eps = 1e-8;
const double inf = 1e15;
const double pi = acos(-1.0);
const long long mod = 998244353LL, gg = 3LL, inv2 = 499122177LL;
inline long long read() {
  long long x = 0;
  bool t = false;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') t = true, ch = getchar();
  while (ch <= '9' && ch >= '0') x = x * 10 + ch - 48, ch = getchar();
  return t ? -x : x;
}
int n, a[maxn][maxn];
int tt, id[maxn][maxn];
pair<int, int> mmap[maxn * maxn];
double dp[maxn * maxn];
int main() {
  n = 10, tt = 101;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) a[i][j] = read();
  for (int i = 1; i <= n; ++i) {
    int st = 1, en = n + 1, delta = 1;
    if (!(i & 1)) st = n, en = 0, delta = -1;
    for (int j = st; j != en; j += delta)
      id[i][j] = --tt, mmap[tt] = make_pair(i, j);
  }
  tt = 100;
  dp[tt] = 0;
  for (int now = tt - 1; now >= 1; --now) {
    int x = mmap[now].first, y = mmap[now].second;
    double tmp = 0;
    int cnt = 0;
    for (int i = 1; i <= 6; ++i) {
      if (now + i > tt)
        ++cnt;
      else {
        int xx = mmap[now + i].first, yy = mmap[now + i].second;
        if (a[xx][yy]) {
          int des = id[xx - a[xx][yy]][yy];
          tmp += (min(dp[now + i], dp[des]) + 1) / 6.0;
        } else
          tmp += (dp[now + i] + 1) / 6.0;
      }
    }
    tmp += 1.0 * cnt / 6.0;
    dp[now] = 6.0 * tmp / (6.0 - cnt);
  }
  printf("%.10f\n", dp[1]);
  return 0;
}
