#include <bits/stdc++.h>
using namespace std;
int arr[10][10];
double me[10][10];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n = 10;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> arr[i][j];
    }
  }
  me[0][0] = 0.;
  me[0][1] = 6.;
  me[0][2] = 6.;
  me[0][3] = 6.;
  me[0][4] = 6.;
  me[0][5] = 6.;
  double fix = 1. / 6.;
  for (int i = 0; i < n; i++) {
    if (i % 2 == 0) {
      for (int j = (i == 0) ? 6 : 0; j < n; j++) {
        double best = 1e6;
        for (int k = 0; k <= (1 << 6) - 1; k++) {
          double summ = 1;
          for (int s = 0; s < 6; s++) {
            if (((k >> s) & 1) == 1) {
              int posx = (j - s - 1 >= 0)
                             ? j - s - 1
                             : n - (((j - s - 1) % 10 + 10) % 10) - 1;
              int posy = (j - s - 1 >= 0 || i == 0) ? i : i - 1;
              summ += fix * me[posy - arr[posy][posx]][posx];
            } else {
              int posx = (j - s - 1 >= 0)
                             ? j - s - 1
                             : n - (((j - s - 1) % 10 + 10) % 10) - 1;
              int posy = (j - s - 1 >= 0 || i == 0) ? i : i - 1;
              summ += fix * me[posy][posx];
            }
          }
          best = min(best, summ);
        }
        me[i][j] = best;
      }
    } else {
      for (int j = n - 1; j >= 0; j--) {
        double best = 1e6;
        for (int k = 0; k <= (1 << 6) - 1; k++) {
          double summ = 1;
          for (int s = 0; s < 6; s++) {
            if (((k >> s) & 1) == 1) {
              int posx = (j + s + 1 < n) ? j + s + 1
                                         : n - ((j + s + 1) % 10 + 10) % 10 - 1;
              int posy = (j + s + 1 < n || i == 0) ? i : i - 1;
              summ += fix * me[posy - arr[posy][posx]][posx];
            } else {
              int posx = (j + s + 1 < n) ? j + s + 1
                                         : n - ((j + s + 1) % 10 + 10) % 10 - 1;
              int posy = (j + s + 1 < n || i == 0) ? i : i - 1;
              summ += fix * me[posy][posx];
            }
          }
          best = min(best, summ);
        }
        me[i][j] = best;
      }
    }
  }
  cout.precision(9);
  cout << fixed << me[9][0];
}
