#include <bits/stdc++.h>
using namespace std;
int main() {
  int n = 10;
  int ar[n][n];
  for (int i = 9; i >= 0; i--)
    for (int j = 0; j < n; j++) cin >> ar[i][j];
  vector<pair<int, int> > pt;
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
      int x = j;
      if (i % 2 == 1) x = 9 - j;
      pt.push_back(make_pair(i, x));
    }
  }
  double dp[n][n];
  double dp2[n][n];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      dp[i][j] = 0;
      dp2[i][j] = 0;
    }
  dp[9][0] = 0;
  for (int i = 98; i >= 0; i--) {
    int a1 = pt[i].first, a2 = pt[i].second;
    dp[a1][a2] = 6.0;
    double x = ar[a1][a2];
    for (int j = 1; i + j < 100 && j <= 6; j++) {
      int b1 = pt[i + j].first, b2 = pt[i + j].second;
      dp[a1][a2] += (dp[b1][b2]);
    }
    dp[a1][a2] /= (min(6, 99 - i));
    dp2[a1][a2] = dp[a1][a2];
    dp[a1][a2] = min(dp[a1][a2], dp2[a1 + ar[a1][a2]][a2]);
  }
  cout << fixed << setprecision(20) << dp[0][0] << endl;
  return 0;
}
