#include <bits/stdc++.h>
using namespace std;
template <typename S, typename T>
ostream& operator<<(ostream& out, const pair<S, T> p) {
  out << "(" << p.first << "," << p.second << ")";
  return out;
}
template <typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
  for (auto a : v) out << a << " ";
  return out;
}
template <typename T>
ostream& operator<<(ostream& out, const set<T>& S) {
  for (auto a : S) cout << a << " ";
  return out;
}
template <typename T>
ostream& operator<<(ostream& out, const multiset<T>& S) {
  for (auto a : S) cout << a << " ";
  return out;
}
template <typename S, typename T>
ostream& operator<<(ostream& out, const map<S, T>& M) {
  for (auto m : M) cout << "(" << m.first << "->" << m.second << ") ";
  return out;
}
template <typename S, typename T>
pair<S, T> operator+(pair<S, T> a, pair<S, T> b) {
  return make_pair(a.first + b.first, a.second + b.second);
}
template <typename S, typename T>
pair<S, T> operator-(pair<S, T> a, pair<S, T> b) {
  return make_pair(a.first - b.first, a.second - b.second);
}
map<pair<int, int>, int> M;
void build_table() {
  int n = 10;
  vector<vector<int>> A(n, vector<int>(n));
  for (int i = n - 1, cnt = 0; i >= 0; i--) {
    if ((n - 1 - i) % 2 == 0) {
      for (int j = 0; j < n; j++) A[i][j] = cnt++;
    } else {
      for (int j = n - 1; j >= 0; j--) A[i][j] = cnt++;
    }
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) M[make_pair(i, j)] = A[i][j];
}
vector<long double> dp;
long double solve(vector<vector<int>>& A, vector<int>& B) {
  int n = A.size();
  int m = n * n;
  B.resize(m);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      int s = M[make_pair(i, j)];
      if (A[i][j] == 0) {
        B[s] = s;
      } else {
        int k = i - A[i][j];
        int t = M[make_pair(k, j)];
        B[s] = t;
      }
    }
  }
  dp.assign(m, 1e18L);
  dp[m - 1] = 0;
  for (int i = m - 2; i >= 0; i--) {
    long double val = 1.0l;
    int cnt = 0;
    for (int j = 1; j <= 6 && i + j < m; j++) {
      long double tmp = min(dp[i + j], dp[B[i + j]]);
      val += tmp / 6.0L;
      cnt++;
    }
    if (cnt < 6) {
      val *= 6;
      val /= cnt;
    }
    dp[i] = val;
  }
  return dp[0];
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  build_table();
  int n = 10;
  vector<vector<int>> A(n, vector<int>(n));
  vector<int> B;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) cin >> A[i][j];
  long double ans = solve(A, B);
  cout << fixed << setprecision(10) << ans << endl;
  return 0;
}
