#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int X = 0, w = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') w = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') X = X * 10 + c - '0', c = getchar();
  return X * w;
}
const int N = 100 + 10;
inline int id(int x, int y) {
  if (x & 1)
    return (x - 1) * 10 + y;
  else
    return (x - 1) * 10 + 11 - y;
}
int to[N];
double dp[N];
int main() {
  for (register int i = 1; i <= 10; ++i)
    for (register int j = 1; j <= 10; ++j) to[id(i, j)] = id(i - read(), j);
  for (register int i = 2; i <= 6; ++i) {
    for (register int j = 1; j < i; ++j) dp[i] += dp[j] / 6;
    dp[i] = (dp[i] + 1) / (i - 1) * 6;
  }
  for (register int i = 7; i <= 100; ++i) {
    for (register int j = 1; j <= 6; ++j)
      dp[i] += min(dp[i - j], dp[to[i - j]]);
    dp[i] = dp[i] / 6 + 1;
  }
  printf("%.10lf\n", dp[100]);
  return 0;
}
