#include <bits/stdc++.h>
using namespace std;
int a[10][10];
double dp[100] = {0};
int f(int x) {
  int i = x / 10;
  int j;
  if (i % 2 == 0)
    j = x % 10;
  else
    j = 9 - x % 10;
  int c = a[i][j];
  if (c == 0) return x;
  if (c % 2 == 0)
    return x + 10 * c;
  else if (i % 2 == 1)
    return x + 20 * (c / 2) + (2 * j + 1);
  else
    return x + 20 * (c / 2) + (19 - 2 * j);
}
int main() {
  cout << fixed << setprecision(10);
  for (int i = 9; i > -1; i--)
    for (int j = 0; j < 10; j++) cin >> a[i][j];
  dp[99] = 0;
  for (int i = 98; i >= 94; i--) {
    int j;
    for (j = 1; j + i <= 99 and j <= 6; j++)
      dp[i] = dp[i] + (dp[j + i] + 1) / 6;
    dp[i] += (i - 93) / 6.0;
    dp[i] = 6 * dp[i] / (99 - i);
  }
  for (int i = 93; i >= 0; i--) {
    dp[i] = 1;
    for (int j = 1; j <= 6; j++)
      dp[i] = dp[i] + (min(dp[i + j], dp[f(i + j)]) / 6.0);
  }
  cout << dp[0];
}
