#include <bits/stdc++.h>
using namespace std;
const int N = 1e1 + 5;
int a[N][N], pos[N][N], last[N * N];
double ev[N * N], reg[N * N];
int main() {
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
      scanf("%d", &a[i][j]);
      if (i % 2 == 0) {
        pos[i][j] = 10 * i + j;
      } else {
        pos[i][j] = 10 * i + 9 - j;
      }
      last[pos[i][j]] = pos[i - a[i][j]][j];
    }
  }
  ev[0] = 0;
  for (int i = 1; i < 100; i++) {
    double sum = 0;
    int cnt = 0;
    for (int j = i - 1; j >= max(i - 6, 0); j--) {
      sum += ev[j];
      cnt++;
    }
    ev[i] = 1 + (1.0 * sum / 6);
    ev[i] *= 6.0 / cnt;
    reg[i] = ev[i];
    ev[i] = min(ev[i], reg[last[i]]);
  }
  printf("%.7f\n", ev[99]);
  return 0;
}
