#include <bits/stdc++.h>
using namespace std;
int jmp[105];
double f[105];
int id(int first, int second) {
  return (10 - first) * 10 + (first & 1 ? (10 - second + 1) : second);
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  for (int i = 1; i <= 10; ++i)
    for (int j = 1; j <= 10; ++j) {
      int first;
      cin >> first;
      if (first)
        jmp[id(i, j)] = id(i - first, j);
      else
        jmp[id(i, j)] = id(i, j);
    }
  for (int i = 99; i >= 94; --i) f[i] = 6;
  for (int i = 93; i >= 1; --i) {
    f[i] = 1;
    for (int j = 1; j <= 6; ++j) f[i] += min(f[i + j], f[jmp[i + j]]) / 6.0;
  }
  cout << fixed << setprecision(7) << f[1];
}
