#include <bits/stdc++.h>
using namespace std;
bool DEBUG = false;
using ll = long long;
using ull = unsigned long long;
int MAXINT = 2e9;
ll MAXLL = 9e18;
int transform(int row, int col) {
  int ans = 0;
  ans += 100 - 10 * (row + 1);
  if (row % 2 == 0) {
    ans += 9 - col;
  } else
    ans += col;
  return ans;
}
int main() {
  {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout << setprecision(30) << fixed;
  }
  vector<vector<int>> raw(10, vector<int>(10, 0));
  for (int i = (0); i < (int)(10); ++i) {
    for (int u = (0); u < (int)(10); ++u) {
      int deltarows;
      cin >> deltarows;
      if (deltarows != 0)
        raw[i][u] = transform(i - deltarows, u);
      else
        raw[i][u] = -1;
    }
  }
  for (int rewi = 0; rewi < 10; rewi += 2) {
    reverse((raw[rewi]).begin(), (raw[rewi]).end());
  }
  vector<int> ldata;
  for (int u = 9; u >= 0; u--) {
    for (auto a : raw[u]) ldata.push_back(a);
  }
  vector<long double> mydata(100, 127.0);
  vector<long double> ladata(100, 127.0);
  for (int i = 99; i >= 0; i--) {
    if (i == 99)
      mydata[i] = 0.0;
    else if (i >= 93) {
      int nk = 100 - 1 - i;
      long double ek = 0;
      for (int ii = (i + 1); ii < (int)(i + 1 + nk); ++ii) {
        ek += mydata[ii];
      }
      ek /= 6;
      mydata[i] = (ek + 1.0) * 6.0 / nk;
    } else {
      long double myek = 0;
      for (int ii = (i + 1); ii < (int)(i + 1 + 6); ++ii) {
        myek += min(ladata[ii], mydata[ii]);
      }
      myek /= 6;
      mydata[i] = myek + 1;
      ladata[i] = mydata[i];
      if (ldata[i] != -1) {
        long double t = mydata[ldata[i]];
        if (t < mydata[i]) ladata[i] = min(t, mydata[i]);
      }
    }
  }
  cout << mydata[0];
}
