#include <bits/stdc++.h>
using namespace std;
const int MX = 11;
const double p = 1.0 / 6.0;
const long long n = 10;
long long h[MX][MX];
bool chk[MX][MX];
double dp[MX][MX];
double func(long long x, long long y) {
  if (x == n && y == 1) return 0;
  if (chk[x][y]) return dp[x][y];
  chk[x][y] = 1;
  double ans = 0;
  long long i, j, k = 0;
  for (i = 1; i <= 6; ++i) {
    long long tx = x, ty = y, tdir = x % 2, tcnt = 0;
    if (tdir)
      ty += i;
    else
      ty -= i;
    if (ty < 1) tx++, ty = -ty + 1;
    if (ty > 10) tx++, ty = 21 - ty;
    if (tx > n) {
      if (!k) k = 6 - i + 1;
      continue;
    }
    ans += p * min(func(tx, ty), func(tx + h[tx][ty], ty));
  }
  return dp[x][y] = (ans + 1.0) / (1.0 - p * k);
}
int main() {
  long long i, j, k;
  for (i = 10; i >= 1; --i)
    for (j = 1; j <= n; ++j) cin >> h[i][j];
  cout << setprecision(10) << fixed << func(1, 1) << endl;
}
