#include <bits/stdc++.h>
using namespace std;
using lld = long long;
int f(int x, int y) { return (x % 2 == 0 ? 10 * x + y : 10 * (x + 1) - y - 1); }
int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  vector<vector<int> > t(10, vector<int>(10));
  for (auto& i : t)
    for (int& j : i) cin >> j;
  vector<int> jp(100, -1);
  for (int i = 0; i < 10; i++)
    for (int j = 0; j < 10; j++) jp[f(i, j)] = f(i - t[i][j], j);
  vector<double> dp(100);
  dp[0] = 0;
  dp[1] = 6.0;
  dp[2] = 6.0;
  dp[3] = 6.0;
  dp[4] = 6.0;
  dp[5] = 6.0;
  for (int i = 6; i < 100; i++) {
    dp[i] = 0;
    for (int j = 1; j <= 6; j++) dp[i] += min(dp[i - j], dp[jp[i - j]]);
    dp[i] /= 6.0;
    dp[i] += 1.0;
  }
  cout << fixed << setprecision(9) << dp[99] << "\n";
  return 0;
}
