#include <bits/stdc++.h>
using namespace std;
const int N = 10;
int h[20][20];
long double E[20][20];
bool vis[20][20];
void init() {
  for (int i = 1; i <= 10; i++) {
    for (int j = 1; j <= 10; j++) {
      cin >> h[i][j];
    }
  }
}
pair<int, int> go_next(int x, int y) {
  if (x % 2 == 1) {
    if (y > 1)
      return make_pair(x, y - 1);
    else
      return make_pair(x - 1, y);
  } else {
    if (y < 10)
      return make_pair(x, y + 1);
    else
      return make_pair(x - 1, y);
  }
}
long double dp(int x, int y) {
  if (vis[x][y]) return E[x][y];
  double e = 0;
  int tx = x, ty = y;
  for (int i = 1; i <= 6; i++) {
    std::tie(tx, ty) = go_next(tx, ty);
    long double p = dp(tx, ty);
    if (h[tx][ty] > 0) {
      p = min(p, dp(tx - h[tx][ty], ty));
    }
    e += (p + 1) / 6.0;
  }
  E[x][y] = e;
  vis[x][y] = true;
  return E[x][y];
}
void work() {
  E[1][1] = 0.0;
  E[1][2] = 6.0;
  E[1][3] = 3.0 + 0.5 * E[1][2];
  E[1][4] = 2.0 + E[1][2] / 3.0 + E[1][3] / 3.0;
  E[1][5] = 1.5 + 1.0 / 4.0 * (E[1][2] + E[1][3] + E[1][4]);
  E[1][6] = 1.2 + 1.0 / 5.0 * (E[1][2] + E[1][3] + E[1][4] + E[1][5]);
  memset(vis, false, sizeof(vis));
  for (int i = 1; i <= 6; i++) vis[1][i] = true;
  dp(10, 1);
  cout << std::setprecision(8) << std::fixed << E[10][1] << endl;
}
int main() {
  init();
  work();
  return 0;
}
