#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T, class U>
ostream& operator<<(ostream& o, const pair<T, U>& p) {
  o << "(" << p.first << "," << p.second << ")";
  return o;
}
template <class T>
ostream& operator<<(ostream& o, const vector<T>& v) {
  o << "[";
  for (T t : v) {
    o << t << ",";
  }
  o << "]";
  return o;
}
const int L = 10;
const int N = 100;
int main() {
  int h[L][L];
  for (int i = 0; i < (int)(L); ++i)
    for (int j = 0; j < (int)(L); ++j) scanf(" %d", &h[i][j]);
  int f[L][L];
  int idx = 0;
  for (int i = L - 1; i >= 0; --i) {
    int j = 0;
    int m = 1;
    if (i % 2 == 0) {
      j = L - 1;
      m = -1;
    }
    for (int loop = 0; loop < (int)(L); ++loop) {
      f[i][j] = idx++;
      j += m;
    }
  }
  int nx[N];
  for (int i = 0; i < (int)(L); ++i)
    for (int j = 0; j < (int)(L); ++j) nx[f[i][j]] = f[i - h[i][j]][j];
  vector<double> E(N);
  for (int i = N - 2; i >= 0; --i) {
    double v = 1;
    int ct = 0;
    for (int j = 1; j <= 6; ++j) {
      if (i + j < N)
        v += min(E[i + j], E[nx[i + j]]) / 6;
      else
        ++ct;
    }
    E[i] = v * 6 / (6 - ct);
  }
  printf("%.15f\n", E[0]);
  return 0;
}
