#include <bits/stdc++.h>
using namespace std;
const int N = 17;
int mat[N][N];
double f[N * N];
inline int nxt(int i, int h) {
  int h1 = i / 10;
  int x1 = h1 % 2 == 0 ? i % 10 : (9 - i % 10);
  int h2 = h1 + h;
  int x2 = x1;
  return 10 * h2 + (h2 % 2 == 0 ? x2 : (9 - x2));
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  for (int i = 0; i < 10; ++i) {
    for (int j = 0; j < 10; ++j) {
      cin >> mat[i][j];
    }
  }
  vector<int> v;
  int troca = 0;
  for (int i = 9; i >= 0; --i) {
    for (int j = 0; j < 10; ++j) {
      if (troca == 0)
        v.push_back(mat[i][j]);
      else
        v.push_back(mat[i][9 - j]);
    }
    troca = 1 - troca;
  }
  f[99] = 0;
  for (int i = 98; i >= 0; --i) {
    int d = min(6, 99 - i);
    double ans = 1;
    for (int j = 1; j <= d; ++j) {
      ans += min(f[i + j], (v[i + j] ? f[nxt(i + j, v[i + j])] : 1e18)) / 6;
    }
    ans = 6 * ans / d;
    f[i] = ans;
  }
  cout << fixed << setprecision(10) << f[0] << endl;
}
