#include <bits/stdc++.h>
using namespace std;
int h[11][11];
double dp[11][11];
bool vis[11][11];
double solve(int row, int col) {
  if (row == 1 && col == 1) return 0.0;
  if (row == 1 && col <= 6) return 6.0;
  if (vis[row][col]) return dp[row][col];
  double ret = 0;
  for (int dice = 1; dice <= 6; dice++) {
    int new_col = col, new_row = row;
    if (row % 2 == 1) {
      if (new_col - dice >= 1)
        new_col -= dice;
      else {
        new_row--;
        new_col = dice - new_col + 1;
      }
    } else {
      if (new_col + dice <= 10)
        new_col += dice;
      else {
        new_row--;
        new_col = 11 - (dice + new_col - 10);
      }
    }
    double ans1 = 1.0 + solve(new_row, new_col);
    double ans2 = 1.0 + solve(new_row - h[new_row][new_col], new_col);
    ret += min(ans1, ans2);
  }
  vis[row][col] = 1;
  return dp[row][col] = ret / 6.0;
}
double pd[200];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout << setprecision(12) << fixed;
  for (int i = 1; i <= 10; i++)
    for (int j = 1; j <= 10; j++) cin >> h[i][j];
  cout << solve(10, 1) << endl;
  return 0;
}
