#include <bits/stdc++.h>
using namespace std;
const int N = 111;
const int inf = 1 << 30;
int id[N][N], h[N][N], nxt[N];
double f[N];
int main() {
  for (int i = 1; i <= 10; i++)
    for (int j = 1; j <= 10; j++) {
      cin >> h[i][j];
    }
  int now = 0;
  for (int i = 1; i <= 10; i++) {
    if (i % 2 == 1)
      for (int j = 1; j <= 10; j++) {
        id[i][j] = ++now;
        if (h[i][j])
          nxt[now] = id[i - h[i][j]][j];
        else
          nxt[now] = now;
        f[now] = inf;
      }
    else
      for (int j = 10; j; j--) {
        id[i][j] = ++now;
        if (h[i][j])
          nxt[now] = id[i - h[i][j]][j];
        else
          nxt[now] = now;
        f[now] = inf;
      }
  }
  f[1] = 0;
  f[7] = f[2] = f[3] = f[4] = f[5] = f[6] = 6;
  for (int i = 7; i <= 100; i++) {
    double sum = 0;
    for (int j = 1; j <= 6; j++) sum += min(f[i - j], f[nxt[i - j]]);
    f[i] = (sum / 6) + 1;
  }
  cout << setprecision(10) << f[100] << endl;
}
