#include <bits/stdc++.h>
using namespace std;
long long int mod = 1e9 + 7;
long long int Max = 1e18;
long long int powe(long long int a, long long int b, long long int mod) {
  if (b == 0) return 1;
  long long int x = powe(a, b / 2, mod) % mod;
  if (b % 2 == 0)
    return (x * x) % mod;
  else
    return (((x * x) % mod) * a) % mod;
}
long double powe(long double a, long long int b) {
  if (b == 0) return 1;
  long double x = powe(a, b / 2);
  if (b % 2 == 0)
    return (x * x);
  else
    return x * x * a;
}
long long int PrintAns(long long int p, long long int q, long long int mod) {
  return (p * (powe(q, mod - 2, mod))) % mod;
}
long long int gcd(long long int a, long long int b) {
  if (a < b) swap(a, b);
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long int setbit(long long int x) {
  long long int c = 0;
  while (x) {
    x = x & (x - 1);
    c++;
  }
  return c;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n = 10, i, j = 0, k, x = 1;
  long double p = 1.0 / 6.0, ans[n * n];
  long long int a[n][n], b[n * n];
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      cin >> a[i][j];
      ans[i * n + j] = 0.0;
    }
  }
  k = 0;
  for (i = n - 1; i >= 0; i--) {
    if (i % 2 == 1) {
      j = 0;
      x = 1;
    } else {
      j = n - 1;
      x = -1;
    }
    for (; j < n && j >= 0; j += x) {
      if (a[i][j] % 2 == 0 || a[i][j] == 0) {
        b[k++] = a[i][j] * n;
      } else {
        if (i % 2 == 0) {
          b[k++] = n * (a[i][j] - 1) + 2 * j + 1;
        } else {
          b[k++] = n * (a[i][j] - 1) + 2 * (n - j - 1) + 1;
        }
      }
    }
  }
  ans[98] = ans[97] = ans[96] = ans[95] = ans[94] = 6.0;
  for (i = 93; i >= 0; i--) {
    for (j = i + 1; j - i <= 6; j++) {
      ans[i] += p * min(ans[j], ans[j + b[j]]);
    }
    ans[i] += 1;
  }
  cout << fixed << setprecision(9) << ans[0];
  return 0;
}
