#include <bits/stdc++.h>
using namespace std;
long long h[10][10];
long double dp[10][10];
pair<long long, long long> sum(long long i, long long j, long long m) {
  if (m == 0) return {i, j};
  if (i & 1) {
    if (j != 9) {
      return sum(i, j + 1, m - 1);
    } else {
      return sum(i - 1, j, m - 1);
    }
  } else {
    if (j != 0) {
      return sum(i, j - 1, m - 1);
    } else {
      return sum(i - 1, j, m - 1);
    }
  }
}
long double f(long long i, long long j) {
  long double &r = dp[i][j];
  if (r >= 0) return r;
  if (i == 0 && j == 0) {
    r = 0;
    return r;
  }
  if (i == 0 && j <= 6) {
    r = 6;
    return r;
  }
  r = 1;
  for (int k = 1, ggdem = 7; k < ggdem; ++k) {
    pair<long long, long long> s = sum(i, j, k);
    r += ((long double)1) / 6 *
         (min(f(s.first, s.second),
              f(s.first - h[s.first][s.second], s.second)));
  }
  return r;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  for (int i = 0, ggdem = 10; i < ggdem; ++i) {
    for (int j = 0, ggdem = 10; j < ggdem; ++j) {
      cin >> h[i][j];
    }
  }
  memset((dp), (-1), sizeof(dp));
  cout << fixed << setprecision(10) << f(9, 0);
  return 0;
}
