#include <bits/stdc++.h>
using namespace std;
const int maxn = 15;
int nx[maxn][maxn], ny[maxn][maxn];
int n, m, ans, ask;
int a[maxn][maxn];
double dp[maxn][maxn];
double slove(int x, int y) {
  if (x == 1 && y == 1) return dp[x][y] = 0;
  if (dp[x][y] != 1e9) return dp[x][y];
  int num = 6;
  double res = 0;
  int xx = x, yy = y;
  for (int i = 1; i <= 6; i++) {
    int px = nx[xx][yy], py = ny[xx][yy];
    xx = px, yy = py;
    if (!px || !py)
      num--;
    else
      res += min(slove(px, py), slove(px - a[px][py], py)) / 6.0;
  }
  return dp[x][y] = (res + 1.0) * 6.0 / num;
}
int main() {
  n = 10;
  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--) {
        ny[i][j] = j - 1;
        nx[i][j] = i;
      }
      nx[i][1] = i - 1;
      ny[i][1] = 1;
    } else {
      for (int j = 1; j <= 9; j++) {
        ny[i][j] = j + 1;
        nx[i][j] = i;
      }
      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("%.10lf", slove(10, 1));
  return 0;
}
