#include <bits/stdc++.h>
using namespace std;
int a[105];
double dp[105];
inline int f(int x, int y) {
  if (y % 2 == 0) return x + y * 10;
  return x + 10 * (y / 2 * 2) + (10 - (x - 1) % 10) * 2 - 1;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  for (int i = 10; i >= 1; i--) {
    if (i % 2 == 0)
      for (int j = 10; j >= 1; j--) cin >> a[(i - 1) * 10 + j];
    else
      for (int j = 1; j <= 10; j++) cin >> a[(i - 1) * 10 + j];
  }
  for (int i = 1; i <= 100; i++) a[i] = f(i, a[i]);
  dp[100] = 0.0;
  for (int i = 99; i >= 1; i--) {
    dp[i] = 1.0;
    for (int j = 1; j <= min(6, 100 - i); j++)
      dp[i] += (1.0 / 6.0) * min(dp[i + j], dp[a[i + j]]);
    dp[i] *= (6.0 / min(6.0, 100.0 - i));
  }
  cout << fixed << setprecision(7) << dp[1];
  return 0;
}
