#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
void ckmin(T &a, U b) {
  if (a > b) a = b;
}
template <class T, class U>
void ckmax(T &a, U b) {
  if (a < b) a = b;
}
int grid[10][10];
long double dp[10][10][2];
long double sixth = 1.0 / 6.0;
pair<int, int> getnext(int a, int b) {
  if (a == 9 && b == 0) {
    return {-1, -1};
  }
  if (a & 1) {
    if (b == 0) {
      return {a + 1, b};
    }
    return {a, b - 1};
  } else {
    if (b == 9) {
      return {a + 1, b};
    }
    return {a, b + 1};
  }
}
int32_t main() {
  cout << fixed << setprecision(12);
  cerr << fixed << setprecision(4);
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  for (auto i = (0); i < (10); i++) {
    for (auto j = (0); j < (10); j++) {
      cin >> grid[9 - i][j];
    }
  }
  for (auto i = (10) - 1; i >= (0); i--) {
    if (i & 1) {
      for (auto j = (0); j < (10); j++) {
        if (i == 9 && j == 0) {
          dp[i][j][0] = 0.0;
          dp[i][j][1] = 0.0;
          continue;
        }
        int x = i, y = j, k = 0;
        while (k < 6 && make_pair(x, y) != make_pair(9, 0)) {
          tie(x, y) = getnext(x, y);
          dp[i][j][0] += sixth * dp[x][y][1];
          k++;
        }
        dp[i][j][0] += 1.0;
        dp[i][j][0] *= 6.0;
        dp[i][j][0] /= k;
        dp[i][j][1] = dp[i][j][0];
        if (grid[i][j]) {
          ckmin(dp[i][j][1], dp[i + grid[i][j]][j][0]);
        }
      }
    } else {
      for (auto j = (10) - 1; j >= (0); j--) {
        int x = i, y = j, k = 0;
        while (k < 6 && make_pair(x, y) != make_pair(9, 0)) {
          tie(x, y) = getnext(x, y);
          dp[i][j][0] += sixth * dp[x][y][1];
          k++;
        }
        dp[i][j][0] += 1.0;
        dp[i][j][0] *= 6.0;
        dp[i][j][0] /= k;
        dp[i][j][1] = dp[i][j][0];
        if (grid[i][j]) {
          ckmin(dp[i][j][1], dp[i + grid[i][j]][j][0]);
        }
      }
    }
  }
  cout << dp[0][0][0] << '\n';
  return 0;
}
