#include <bits/stdc++.h>
using namespace std;
const int Nmax = 1e6 + 7;
int mp[15][15];
vector<pair<int, int> > v;
double dp[15][15];
double dp2[15][15];
int main() {
  for (int i = 1; i <= 10; i++) {
    for (int j = 1; j <= 10; j++) {
      scanf("%d", &mp[i][j]);
    }
  }
  for (int i = 10; i >= 1; i--) {
    if (i & 1)
      for (int j = 10; j >= 1; j--) v.push_back(pair<int, int>(i, j));
    else
      for (int j = 1; j <= 10; j++) v.push_back(pair<int, int>(i, j));
  }
  dp[1][1] = dp2[1][1] = 0.0;
  for (int k = 98; k >= 0; k--) {
    int i = v[k].first, j = v[k].second;
    dp[i][j] = 0.0;
    int num = min(6, 99 - k);
    for (int t = 1; t <= num; t++) {
      dp[i][j] += dp2[v[k + t].first][v[k + t].second] / (double)num;
    }
    dp[i][j] += 6.0 / (double)num;
    dp2[i][j] = min(dp[i][j], dp[i - mp[i][j]][j]);
  }
  printf("%.10lf\n", dp[10][1]);
  return 0;
}
