#include <bits/stdc++.h>
using namespace std;
const int n = 10;
int arr[n + 1][n + 1];
long double dp[n + 1][n + 1];
long double getValue(long double first, long double second) {
  long double frac = first / second;
  frac = 1 - frac;
  return 1 / (frac * frac);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      cin >> arr[i][j];
    }
    if (i == 1) {
      dp[1][1] = 0;
      for (int j = 2; j <= 6; j++) {
        dp[i][j] = 6;
      }
      for (int j = 7; j <= 10; j++) {
        dp[i][j] = 1;
        for (int k = j - 6; k < j; k++) dp[i][j] = dp[i][j] + dp[i][k] / 6;
      }
    } else if (i % 2 == 0) {
      for (int j = 10; j >= 1; j--) {
        int curx = i, cury = j;
        dp[i][j] = 1;
        for (int d = 1; d <= 6; d++) {
          int nx = curx, ny = cury + d;
          if (ny > 10) {
            int diff = ny - 10;
            ny = 10 - diff + 1;
            nx--;
          }
          long double best = dp[nx][ny];
          if (arr[nx][ny] != 0) best = min(best, dp[nx - arr[nx][ny]][ny]);
          dp[i][j] = dp[i][j] + best / 6;
        }
      }
    } else {
      for (int j = 1; j <= 10; j++) {
        int curx = i, cury = j;
        dp[i][j] = 1;
        for (int d = 1; d <= 6; d++) {
          int nx = i, ny = cury - d;
          if (ny < 1) {
            nx--;
            ny = abs(ny) + 1;
          }
          long double best = dp[nx][ny];
          if (arr[nx][ny] != 0) best = min(best, dp[nx - arr[nx][ny]][ny]);
          dp[i][j] = dp[i][j] + best / 6;
        }
      }
    }
  }
  cout.precision(15);
  cout << fixed << dp[10][1];
  return 0;
}
