#include <bits/stdc++.h>
using namespace std;
const int MAXN = 10;
const long long MOD = 1000000007;
double dp[MAXN * MAXN];
int h[MAXN][MAXN];
int id[MAXN][MAXN];
pair<int, int> pos[MAXN * MAXN];
int getID(pair<int, int> p) { return id[p.first][p.second]; }
int climbLadder(int d) {
  pair<int, int> cur = pos[d];
  cur.first -= h[cur.first][cur.second];
  return getID(cur);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  for (int i = 0; i < MAXN; i++) {
    for (int j = 0; j < MAXN; j++) {
      cin >> h[i][j];
    }
  }
  int idx = 0;
  for (int i = MAXN - 1; i >= 0; i--) {
    if (i & 1) {
      for (int j = 0; j < MAXN; j++) {
        id[i][j] = idx;
        pos[idx++] = {i, j};
      }
    } else {
      for (int j = MAXN - 1; j >= 0; j--) {
        id[i][j] = idx;
        pos[idx++] = {i, j};
      }
    }
  }
  dp[MAXN * MAXN - 1] = 0;
  for (int i = 98; i >= 0; i--) {
    int valid = min(MAXN * MAXN - 1 - i, 6);
    double sum = 0;
    for (int j = 1; j <= valid; j++) {
      sum += min(dp[i + j], dp[climbLadder(i + j)]);
    }
    dp[i] = (6 / double(valid)) + sum / valid;
  }
  cout << fixed << setprecision(10) << dp[0] << '\n';
}
