#include <bits/stdc++.h>
using namespace std;
const int N = 110;
int a[N], target[N];
long double dp[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n = 10;
  for (int i = n - 1; i >= 0; --i) {
    for (int j_ = 0; j_ < n; ++j_) {
      int j = (i % 2 == 0 ? j_ : 9 - j_);
      int id = i * n + j;
      cin >> a[id];
      if (a[id] != 0) {
        target[id] = id + n * a[id];
        if (a[id] % 2 == 1) {
          target[id] += (n - 1) - 2 * (target[id] % n);
        }
      } else {
        target[id] = id;
      }
    }
  }
  int t = n * n - 1;
  dp[t] = 0;
  for (int i = t - 1; i >= 0; --i) {
    int bad = 0;
    dp[i] = 1;
    for (int j = 1; j <= 6; ++j) {
      if (i + j > t) {
        ++bad;
      } else {
        dp[i] += min(dp[i + j], dp[target[i + j]]) / 6;
      }
    }
    dp[i] /= (1 - bad / 6.0);
  }
  cout << fixed << setprecision(12) << dp[0] << '\n';
}
