#include <bits/stdc++.h>
using namespace std;
double mini[110];
int conversion(int x, int y) {
  if (x % 2 == 0) {
    return x * 10 + y;
  } else {
    return x * 10 + (9 - y);
  }
}
pair<int, int> inverse(int valeur) {
  pair<int, int> resultat;
  resultat.first = valeur / 10;
  if (resultat.first % 2 == 0) {
    resultat.second = valeur % 10;
  } else {
    resultat.second = 9 - valeur % 10;
  }
  return resultat;
}
int main() {
  int tab[10][10];
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
      cin >> tab[i][j];
    }
  }
  mini[0] = 0.0;
  for (int i = 1; i < 100; i++) {
    pair<int, int> coor = inverse(i);
    int n = 0;
    for (int j = 1; j <= 6; j++) {
      if (i - j < 0) {
        n++;
        continue;
      }
      double autre = 200.0;
      pair<int, int> NN = inverse(i - j);
      if (tab[NN.first][NN.second] != 0) {
        int pos = conversion(NN.first - tab[NN.first][NN.second], NN.second);
        autre = mini[pos];
      }
      mini[i] += 1 + min(mini[i - j], autre);
    }
    mini[i] = (mini[i] + n) / (6.0 - n);
  }
  cout << fixed << setprecision(15) << mini[99] << endl;
}
