#include <bits/stdc++.h>
#pragma comment(linker, "/stack:247474112")
#pragma GCC optimize("Ofast")
using namespace std;
const int INF = 0x3f3f3f3f;
int G[10][10];
long double dp[10][10][2];
int decl(int x, int y) { return x * 10 + (x & 1 ? 9 - y : y); }
void revdecl(int d, int &x, int &y) {
  x = d / 10;
  y = d % 10;
  if (x & 1) {
    y = 9 - y;
  }
}
long double solve(int x, int y, int flg) {
  long double &res = dp[x][y][flg];
  if (res != 0) return res;
  if (x == 0 && y == 0) return 0;
  int cur = decl(x, y);
  if (cur <= 6) return res = 6;
  long double notclb = 0;
  for (int i = 1; i < 7; ++i) {
    int nx = cur - i;
    int s, t;
    if (nx >= 0) {
      revdecl(nx, s, t);
      notclb += 1 + solve(s, t, 1);
    }
  }
  notclb /= 6;
  if (flg == 0 || G[x][y] == 0) {
    return res = notclb;
  }
  return res = min(notclb, solve(x - G[x][y], y, 0));
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  for (int i = 0; i < 10; ++i) {
    for (int j = 0; j < 10; ++j) {
      cin >> G[i][j];
    }
  }
  cout << setiosflags(ios::fixed) << setprecision(12) << solve(9, 0, 1) << endl;
}
