#include <bits/stdc++.h>
using namespace std;
const int o = 1 << 17;
const int mod = 1000000007;
const int inf = 0x3f3f3f3f;
const long long huge = 100000000000000000LL;
const int maxn = 15;
int n;
int a[maxn][maxn];
long double expp[maxn][maxn];
pair<int, int> go(int x, int y, int d) {
  for (int i = 0; i < d; i++) {
    if (x % 2 == 0) {
      y--;
      if (y == -1) {
        x--;
        y++;
      }
    } else {
      y++;
      if (y == n) {
        x--;
        y--;
      }
    }
    if (x == -1) return pair<int, int>(-1, -1);
  }
  return pair<int, int>(x, y);
}
int main() {
  ios::sync_with_stdio(false);
  n = 10;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) cin >> a[i][j];
  for (int i = 0; i < n; i++) {
    int start = 0;
    int end = n;
    int step = 1;
    if (i % 2 == 1) {
      start = n - 1;
      end = -1;
      step *= -1;
    }
    for (int j = start; j != end; j += step) {
      if (i == 0 && j == 0) continue;
      for (int k = 1; k <= 6; k++) {
        pair<int, int> w = go(i, j, k);
        if (w.first == -1) continue;
        if (w.first == 0 && w.second == 0)
          expp[i][j] = 6;
        else
          expp[i][j] +=
              (1 + min(expp[w.first][w.second],
                       expp[w.first - a[w.first][w.second]][w.second])) /
              6;
      }
    }
  }
  cout << setprecision(15) << expp[9][0] << endl;
  return 0;
}
