#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int b[20][20];
double dp[20][20];
void nxt(int &x, int &y) {
  if (x % 2 == 0) {
    if (y < 9) {
      y++;
    } else {
      x++;
    }
  } else {
    if (y > 0) {
      y--;
    } else {
      x++;
    }
  }
}
double solve(int x, int y) {
  if (dp[x][y] != -1) {
    return dp[x][y];
  }
  double now = 1;
  int tx = x, ty = y;
  int gg = 0;
  for (int i = 0; i < 6; i++) {
    nxt(tx, ty);
    if (tx > 9) {
      gg++;
    } else {
      if (b[tx][ty]) {
        now += min(solve(tx + b[tx][ty], ty), solve(tx, ty)) / 6.0;
      } else {
        now += solve(tx, ty) / 6.0;
      }
    }
  }
  if (gg) {
    now *= 6.0 / (6 - gg);
  }
  return dp[x][y] = now;
}
int main() {
  for (int i = 9; i >= 0; i--) {
    for (int j = 0; j < 10; j++) {
      cin >> b[i][j];
      dp[i][j] = -1;
    }
  }
  dp[9][0] = 0;
  cout << fixed << setprecision(10) << solve(0, 0) << endl;
}
