#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
int tex[15][15];
int dis[1005];
double dp[1005];
int main() {
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
      if (i % 2)
        tex[i][j] = i * 10 + 9 - j;
      else
        tex[i][j] = i * 10 + j;
    }
  }
  for (int i = 0; i < 10; i++)
    for (int j = 0; j < 10; j++) {
      int x;
      cin >> x;
      dis[tex[i][j]] = tex[i - x][j];
    }
  dp[0] = 0;
  for (int i = 1; i < 6; i++) dp[i] = 6;
  for (int i = 6; i < 100; i++) {
    double sum = 0;
    for (int j = 1; j < 7; j++) {
      sum += min(dp[i - j], dp[dis[i - j]]);
    }
    dp[i] = sum / 6 + 1;
  }
  cout << setprecision(10) << dp[99] << endl;
  return 0;
}
