#include <bits/stdc++.h>
using namespace std;
using ll = long long;
auto TimeStart = chrono::steady_clock::now();
const int nax = 2e5 + 10, mod = 1000000007;
int Grid[10][10];
pair<int, int> Next[10][10];
using ld = long double;
ld Steps[10][10];
void solve(int caseNo) {
  for (int i = 0; i < 10; ++i)
    for (int j = 0; j < 10; ++j) cin >> Grid[i][j];
  for (int i = 1; i <= 6; ++i) {
    Steps[0][i] = 6;
  }
  for (int i = 7; i < 10; ++i) {
    for (int j = 1; j <= 6; ++j)
      Steps[0][i] += (ld)1 / 6 * (1 + Steps[0][i - j]);
  }
  bool way = 1;
  for (int i = 9; i >= 0; --i) {
    for (int j = 0; j <= 9; ++j) {
      if (way)
        Next[i][j] = {i, j + 1};
      else
        Next[i][j] = {i, j - 1};
    }
    if (way)
      Next[i][9] = {i - 1, 9};
    else
      Next[i][0] = {i - 1, 0};
    way = !way;
  }
  way = 1;
  for (int i = 1; i < 10; ++i) {
    if (way) {
      for (int j = 9; j >= 0; --j) {
        int x = i;
        int y = j;
        ;
        for (int k = 0; k < 6; ++k) {
          int x1 = Next[x][y].first;
          int y1 = Next[x][y].second;
          x = x1, y = y1;
          ;
          Steps[i][j] +=
              ld(1) / 6 * (1 + min(Steps[x - Grid[x][y]][y], Steps[x][y]));
        };
      }
    } else {
      for (int j = 0; j < 10; ++j) {
        int x = i;
        int y = j;
        ;
        for (int k = 0; k < 6; ++k) {
          int x1 = Next[x][y].first;
          int y1 = Next[x][y].second;
          x = x1, y = y1;
          ;
          Steps[i][j] +=
              ld(1) / 6 * (1 + min(Steps[x - Grid[x][y]][y], Steps[x][y]));
        };
      }
    }
    way = !way;
  }
  cout << fixed << setprecision(9);
  cout << Steps[9][0] << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t = 1;
  for (int i = 0; i < t; ++i) solve(i);
  return 0;
}
