#include <bits/stdc++.h>
using namespace std;
int a[12][12];
double dp[12][12];
bool vis[12][12];
int nx[12][12], ny[12][12];
double dfs(int x, int y) {
  if (vis[x][y]) return dp[x][y];
  vis[x][y] = 1;
  if (x == 1 && y == 1) return dp[x][y] = 0;
  double res = 0;
  int px = x, py = y;
  int num = 6;
  for (int k = 1; k <= 6; ++k) {
    int xx = nx[px][py], yy = ny[px][py];
    px = xx;
    py = yy;
    if (!px || !py)
      --num;
    else
      res += min(dfs(px, py), dfs(px - a[px][py], py)) / 6.0;
  }
  dp[x][y] = (res + 1.0) * 6.0 / (double)num;
  return dp[x][y];
}
int main() {
  for (int i = 1; i <= 10; ++i)
    for (int j = 1; j <= 10; ++j) cin >> a[i][j];
  for (int i = 10; i >= 1; --i) {
    if (i & 1) {
      for (int j = 10; j >= 2; --j) nx[i][j] = i, ny[i][j] = j - 1;
      nx[i][1] = i - 1;
      ny[i][1] = 1;
    } else {
      for (int j = 1; j <= 9; ++j) nx[i][j] = i, ny[i][j] = j + 1;
      nx[i][10] = i - 1;
      ny[i][10] = 10;
    }
  }
  for (int i = 1; i <= 10; ++i)
    for (int j = 1; j <= 10; ++j) dp[i][j] = 1e9;
  printf("%.10f\n", dfs(10, 1));
}
