#include <bits/stdc++.h>
using namespace std;
const int n = 10;
long double dp[13][13];
int a[13][13];
using pii = pair<int, int>;
pii go(int x, int y, int amt) {
  if (x % 2 == 0) {
    y += amt;
    if (y > 10) x--, y--;
    if (y > 10) y = 20 - y;
    return make_pair(x, y);
  } else {
    y -= amt;
    if (y < 1) x--, y++;
    if (y < 1) y = 2 - y;
    return make_pair(x, y);
  }
}
int main() {
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) scanf("%d", &a[i][j]);
  for (int i = 1; i <= n; i++) {
    if (i == 1)
      for (int j = 2; j <= 7; j++) dp[i][j] = 6;
    if (i & 1) {
      for (int j = 1; j <= n; j++) {
        if ((i == 1 && j == 1) || dp[i][j]) continue;
        long double sum = 0;
        for (int k = 1; k <= 6; k++) {
          int x = go(i, j, k).first, y = go(i, j, k).second;
          sum += min(dp[x - a[x][y]][y], dp[x][y]);
        }
        dp[i][j] = sum / 6 + 1;
      }
    } else {
      for (int j = n; j >= 1; j--) {
        long double sum = 0;
        for (int k = 1; k <= 6; k++) {
          int x = go(i, j, k).first, y = go(i, j, k).second;
          sum += min(dp[x - a[x][y]][y], dp[x][y]);
        }
        dp[i][j] = sum / 6 + 1;
      }
    }
  }
  printf("%f", (double)dp[10][1]);
  return 0;
}
