#include <bits/stdc++.h>
using namespace std;
long long int lsone(long long int p) { return (p & -p); }
pair<int, int> go(int x, int y, int dir, int s) {
  int xnew = x;
  int ynew = y + dir * s;
  if (ynew > 9) {
    xnew -= 1;
    ynew = 19 - ynew;
  }
  if (ynew < 0) {
    xnew -= 1;
    ynew = -1 - ynew;
  }
  return {xnew, ynew};
}
int main() {
  std::ios::sync_with_stdio(false);
  double c[10][10], ans[10][10], prob;
  pair<int, int> pos;
  int xh, yh;
  int m[10][10], r[10];
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
      cin >> m[i][j];
      ans[i][j] = -1;
    }
  }
  r[0] = 1;
  for (int i = 1; i < 10; i++) {
    r[i] = r[i - 1] * -1;
  }
  ans[0][0] = 0;
  ans[0][1] = 6;
  ans[0][2] = 6;
  ans[0][3] = 6;
  ans[0][4] = 6;
  ans[0][5] = 6;
  ans[0][6] = 6;
  for (int i = 0; i < 10; i++) {
    if (r[i] == 1) {
      for (int j = 0; j < 10; j++) {
        if (ans[i][j] < -0.5) {
          ans[i][j] = 0;
          for (int k = 1; k <= 6; k++) {
            pos = go(i, j, r[i] * -1, k);
            xh = pos.first;
            yh = pos.second;
            prob = ans[xh][yh];
            if (m[xh][yh] > 0) {
              if (prob > ans[xh - m[xh][yh]][yh]) {
                prob = ans[xh - m[xh][yh]][yh];
              }
            }
            ans[i][j] = ans[i][j] + 1.0 / 6.0 * (prob + 1);
          }
        }
      }
    } else if (r[i] == -1) {
      for (int j = 9; j > -1; j--) {
        if (ans[i][j] < -0.5) {
          ans[i][j] = 0;
          for (int k = 1; k <= 6; k++) {
            pos = go(i, j, r[i] * -1, k);
            xh = pos.first;
            yh = pos.second;
            prob = ans[xh][yh];
            if (m[xh][yh] > 0) {
              if (prob > ans[xh - m[xh][yh]][yh]) {
                prob = ans[xh - m[xh][yh]][yh];
              }
            }
            ans[i][j] = ans[i][j] + 1.0 / 6.0 * (prob + 1);
          }
        }
      }
    }
  }
  printf("%.10f", ans[9][0]);
}
