#include <bits/stdc++.h>
using namespace std;
const int N = 11;
int a[N][N];
int n = 10;
double dp[N][N][2];
double func(int x, int y, bool b) {
  if (dp[x][y][b] != -1) return dp[x][y][b];
  if (x == 0 && y == 0) return 0;
  if (x == 0 && y <= 6) return 6;
  double ret = 0;
  if (x % 2 == 1) {
    if (y <= 3) {
      ret += func(x, y + 1, 0) / 6;
      ret += func(x, y + 2, 0) / 6;
      ret += func(x, y + 3, 0) / 6;
      ret += func(x, y + 4, 0) / 6;
      ret += func(x, y + 5, 0) / 6;
      ret += func(x, y + 6, 0) / 6;
      ret++;
    }
    if (y == 4) {
      ret += func(x, y + 1, 0) / 6;
      ret += func(x, y + 2, 0) / 6;
      ret += func(x, y + 3, 0) / 6;
      ret += func(x, y + 4, 0) / 6;
      ret += func(x, y + 5, 0) / 6;
      ret += func(x - 1, 9, 0) / 6;
      ret++;
    }
    if (y == 5) {
      ret += func(x, y + 1, 0) / 6;
      ret += func(x, y + 2, 0) / 6;
      ret += func(x, y + 3, 0) / 6;
      ret += func(x, y + 4, 0) / 6;
      ret += func(x - 1, 8, 0) / 6;
      ret += func(x - 1, 9, 0) / 6;
      ret++;
    }
    if (y == 6) {
      ret += func(x, y + 1, 0) / 6;
      ret += func(x, y + 2, 0) / 6;
      ret += func(x, y + 3, 0) / 6;
      ret += func(x - 1, 7, 0) / 6;
      ret += func(x - 1, 8, 0) / 6;
      ret += func(x - 1, 9, 0) / 6;
      ret++;
    }
    if (y == 7) {
      ret += func(x, y + 1, 0) / 6;
      ret += func(x, y + 2, 0) / 6;
      ret += func(x - 1, 6, 0) / 6;
      ret += func(x - 1, 7, 0) / 6;
      ret += func(x - 1, 8, 0) / 6;
      ret += func(x - 1, 9, 0) / 6;
      ret++;
    }
    if (y == 8) {
      ret += func(x, y + 1, 0) / 6;
      ret += func(x - 1, 5, 0) / 6;
      ret += func(x - 1, 6, 0) / 6;
      ret += func(x - 1, 7, 0) / 6;
      ret += func(x - 1, 8, 0) / 6;
      ret += func(x - 1, 9, 0) / 6;
      ret++;
    }
    if (y == 9) {
      ret += func(x - 1, 4, 0) / 6;
      ret += func(x - 1, 5, 0) / 6;
      ret += func(x - 1, 6, 0) / 6;
      ret += func(x - 1, 7, 0) / 6;
      ret += func(x - 1, 8, 0) / 6;
      ret += func(x - 1, 9, 0) / 6;
      ret++;
    }
  } else {
    if (y >= 6) {
      ret += func(x, y - 1, 0) / 6;
      ret += func(x, y - 2, 0) / 6;
      ret += func(x, y - 3, 0) / 6;
      ret += func(x, y - 4, 0) / 6;
      ret += func(x, y - 5, 0) / 6;
      ret += func(x, y - 6, 0) / 6;
      ret++;
    }
    if (y == 5) {
      ret += func(x, y - 1, 0) / 6;
      ret += func(x, y - 2, 0) / 6;
      ret += func(x, y - 3, 0) / 6;
      ret += func(x, y - 4, 0) / 6;
      ret += func(x, y - 5, 0) / 6;
      ret += func(x - 1, 0, 0) / 6;
      ret++;
    }
    if (y == 4) {
      ret += func(x, y - 1, 0) / 6;
      ret += func(x, y - 2, 0) / 6;
      ret += func(x, y - 3, 0) / 6;
      ret += func(x, y - 4, 0) / 6;
      ret += func(x - 1, 1, 0) / 6;
      ret += func(x - 1, 0, 0) / 6;
      ret++;
    }
    if (y == 3) {
      ret += func(x, y - 1, 0) / 6;
      ret += func(x, y - 2, 0) / 6;
      ret += func(x, y - 3, 0) / 6;
      ret += func(x - 1, 2, 0) / 6;
      ret += func(x - 1, 1, 0) / 6;
      ret += func(x - 1, 0, 0) / 6;
      ret++;
    }
    if (y == 2) {
      ret += func(x, y - 1, 0) / 6;
      ret += func(x, y - 2, 0) / 6;
      ret += func(x - 1, 3, 0) / 6;
      ret += func(x - 1, 2, 0) / 6;
      ret += func(x - 1, 1, 0) / 6;
      ret += func(x - 1, 0, 0) / 6;
      ret++;
    }
    if (y == 1) {
      ret += func(x, y - 1, 0) / 6;
      ret += func(x - 1, 4, 0) / 6;
      ret += func(x - 1, 3, 0) / 6;
      ret += func(x - 1, 2, 0) / 6;
      ret += func(x - 1, 1, 0) / 6;
      ret += func(x - 1, 0, 0) / 6;
      ret++;
    }
    if (y == 0) {
      ret += func(x - 1, 5, 0) / 6;
      ret += func(x - 1, 4, 0) / 6;
      ret += func(x - 1, 3, 0) / 6;
      ret += func(x - 1, 2, 0) / 6;
      ret += func(x - 1, 1, 0) / 6;
      ret += func(x - 1, 0, 0) / 6;
      ret++;
    }
  }
  if (a[x][y] != 0 && !b) {
    ret = min(ret, func(x - a[x][y], y, 1));
  }
  return dp[x][y][b] = ret;
}
int main() {
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> a[i][j];
      dp[i][j][0] = -1;
      dp[i][j][1] = -1;
    }
  }
  double res = func(9, 0, 0);
  cout << setprecision(10) << res;
  return 0;
}
