#include <bits/stdc++.h>
using namespace std;
pair<int, int> move(int i, int j, int k) {
  if (k == 0) return {i, j};
  if (i == 0 && j == 0) return {-1, -1};
  if (i & 1) {
    if (j == 9) return move(i - 1, j, k - 1);
    return move(i, j + 1, k - 1);
  }
  if (j == 0) return move(i - 1, j, k - 1);
  return move(i, j - 1, k - 1);
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  vector<vector<long double>> dp(10, vector<long double>(10));
  vector<vector<int>> h(10, vector<int>(10));
  for (auto &i : h)
    for (auto &j : i) cin >> j;
  long double p = ((long double)1.0) / 6.0;
  dp[0][0] = 0;
  for (int i = 0; i < 10; ++i) {
    int from = 0, to = 10, add = 1;
    if (i & 1) from = 9, to = -1, add = -1;
    for (int j = from; j != to; j += add) {
      if (i == 0 && j == 0) continue;
      int bad = 0;
      long double g = 0;
      for (int k = 1; k <= 6; ++k) {
        int ni, nj;
        tie(ni, nj) = move(i, j, k);
        if (ni == -1)
          ++bad;
        else
          g += min(dp[ni][nj], dp[ni - h[ni][nj]][nj]) + 1;
      }
      dp[i][j] = (bad * p + g * p) / (1 - bad * p);
    }
  }
  cout.precision(15);
  cout << fixed << dp[9][0] << "\n";
  return 0;
}
