#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 5;
const int mod = 1e9 + 7;
long long qpow(long long a, long long b) {
  long long ans = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) ans = ans * a % mod;
    a = a * a % mod;
  }
  return ans;
}
long long gcd(long long a, long long b) { return b > 0 ? gcd(b, a % b) : a; }
int n, m, T;
int a[20][20];
int nxt[105];
pair<int, int> p;
int dir[2][3] = {{10, 0, -1}, {1, 11, 1}};
int idx[10][10];
int h[105];
double dp[maxn];
int main() {
  for (int i = 1; i <= 10; i++) {
    for (int j = 1; j <= 10; j++) {
      if (i & 1)
        idx[i][j] = (i - 1) * 10 + j;
      else
        idx[i][j] = (i - 1) * 10 + (10 - j + 1);
    }
  }
  for (int i = 10; i >= 1; i--) {
    for (int j = 1; j <= 10; j++) {
      cin >> T;
      h[idx[i][j]] = idx[i + T][j];
    }
  }
  dp[10 * 10] = 0;
  for (int i = 1; i < 6; i++) {
    dp[10 * 10 - i] = 6;
  }
  for (int i = 10 * 10 - 6; i >= 1; i--) {
    for (int j = 1; j <= 6; j++) {
      dp[i] += (1.0 + min(dp[i + j], dp[h[i + j]])) / 6.0;
    }
  }
  printf("%.6f\n", dp[1]);
  return 0;
}
