#include <bits/stdc++.h>
using namespace std;
int n = 10;
const int ms = 100;
int grid[ms][ms];
const int inf = 1e9;
int f[ms];
double dp[ms];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(8);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> grid[i][j];
    }
    i++;
    for (int j = n - 1; j >= 0; j--) {
      cin >> grid[i][j];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (grid[i][j] % 2 == 0) {
        f[i * 10 + j] = i * 10 + j - grid[i][j] * 10;
      } else {
        f[i * 10 + j] = i * 10 + (n - j - 1) - grid[i][j] * 10;
      }
    }
    i++;
    for (int j = n - 1; j >= 0; j--) {
      if (grid[i][j] % 2 == 0) {
        f[i * 10 + j] = i * 10 + j - grid[i][j] * 10;
      } else {
        f[i * 10 + j] = i * 10 + (n - j - 1) - grid[i][j] * 10;
      }
    }
  }
  dp[0] = 0.0;
  for (int i = 1; i < ms; i++) {
    double sum = 1;
    double tam = min(i, 6);
    for (int d = 1; d <= tam; d++) {
      sum += 1.0 / 6.0 * min(dp[i - d], dp[f[i - d]]);
    }
    dp[i] = (6.0 / tam) * sum;
  }
  cout << dp[99] << '\n';
}
