#include <bits/stdc++.h>
using namespace std;
void fun() {}
long long int __gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return __gcd(b, a % b);
}
long long int poww(long long int a, long long int b, long long int md) {
  if (b < 0) return 0;
  if (a == 0) return 0;
  long long int res = 1;
  while (b) {
    if (b & 1) {
      res = (1ll * res * a) % md;
    }
    a = (1ll * a * a) % md;
    b >>= 1;
  }
  return res;
}
long long int divide(long long int a, long long int b, long long int md) {
  long long int rr = a * (poww(b, md - 2, md));
  rr %= md;
  return rr;
}
const long long int size = 5e3 + 5;
long double dp[200];
bool vis[200];
long long int mat[11][11];
long long int linear[200];
long long int getIdx(long long int x, long long int y) {
  long long int num = (10 - x) * 10;
  if (x & 1) {
    num += 10 - y + 1;
  } else {
    num += y;
  }
  return num;
}
long double solve(long long int idx) {
  if (idx == 100) return 0;
  if (vis[idx]) return dp[idx];
  vis[idx] = true;
  long double ans = 0;
  for (long long int i = 1; i <= min(6ll, 100 - idx); i++) {
    long double temp1 = solve(idx + i);
    long double temp2 = solve(linear[idx + i]);
    ans += 1 / 6.0 * min(temp1, temp2);
  }
  return dp[idx] = (ans + 1) * 6.0 / (min(6ll, 100 - idx));
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  fun();
  for (long long int i = 1; i <= 10; i++) {
    for (long long int j = 1; j <= 10; j++) {
      cin >> mat[i][j];
      linear[getIdx(i, j)] = getIdx(i - mat[i][j], j);
    }
  }
  cout << setprecision(12) << solve(1) << '\n';
  return 0;
}
