#include <bits/stdc++.h>
using namespace std;
int f[111], a[111];
double dp[111];
int id[11][11];
int main() {
  int t = 100;
  for (int i = 10; i; i--) {
    if (i % 2 == 0) {
      for (int j = 1; j <= 10; j++) id[i][j] = t--;
    } else {
      for (int j = 10; j; j--) id[i][j] = t--;
    }
  }
  for (int i = 10; i; i--) {
    for (int j = 1, x, y, z; j <= 10; j++) {
      cin >> x;
      y = id[i][j];
      if (x) {
        z = id[i + x][j];
        f[y] = z;
      } else {
        f[y] = y;
      }
    }
  }
  dp[100] = 0;
  for (int i = 99; i; i--) {
    dp[i] = 1;
    if (i < 95)
      for (int r = 1; r <= 6; r++) {
        dp[i] += 1.0 / 6.0 * min(dp[i + r], dp[f[i + r]]);
      }
    else {
      for (int r = 1; r <= 100 - i; r++) {
        dp[i] += 1.0 / 6.0 * dp[i + r];
      }
      dp[i] *= 6.0 / (100.0 - i);
    }
  }
  printf("%.10f\n", dp[1]);
  return 0;
}
