#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T1, class T2>
ostream& operator<<(ostream& s, pair<T1, T2> P) {
  return s << '<' << P.first << ", " << P.second << '>';
}
template <class T>
ostream& operator<<(ostream& s, vector<T> P) {
  for (int i = 0; i < P.size(); ++i) {
    if (i > 0) {
      s << " ";
    }
    s << P[i];
  }
  return s;
}
template <class T>
ostream& operator<<(ostream& s, vector<vector<T>> P) {
  for (int i = 0; i < P.size(); ++i) {
    s << endl << P[i];
  }
  return s << endl;
}
template <class T>
ostream& operator<<(ostream& s, set<T> P) {
  for (auto it : P) {
    s << "<" << it << "> ";
  }
  return s << endl;
}
template <class T1, class T2>
ostream& operator<<(ostream& s, map<T1, T2> P) {
  for (auto it : P) {
    s << "<" << it.first << "->" << it.second << "> ";
  }
  return s << endl;
}
vector<vector<int>> L;
using pint = pair<int, int>;
void step(int& h, int& w) {
  if (h % 2 == 0) {
    if (w == 0)
      --h;
    else
      --w;
  } else {
    if (w == 9)
      --h;
    else
      ++w;
  }
};
pint run(int h, int w, int m) {
  for (int i = 0; i < m; ++i) step(h, w);
  return pint(h, w);
};
vector<vector<double>> dp;
double rec(int h, int w) {
  if (h == 0 && w == 0)
    return dp[h][w] = 0.0;
  else if (h == 0 && w <= 6)
    return dp[h][w] = 6.0;
  if (dp[h][w] >= 0) return dp[h][w];
  double res = 0.0;
  for (int m = 1; m <= 6; ++m) {
    pint p = run(h, w, m);
    int nh = p.first, nw = p.second;
    double tmp = rec(nh, nw);
    if (L[nh][nw] != 0) {
      int nh2 = nh - L[nh][nw], nw2 = nw;
      chmin(tmp, rec(nh2, nw2));
    }
    res += tmp;
  }
  return dp[h][w] = res / 6 + 1;
};
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  L.assign(10, vector<int>(10));
  dp.assign(10, vector<double>(10, -1));
  for (int h = 0; h < 10; ++h) {
    for (int w = 0; w < 10; ++w) cin >> L[h][w];
  }
  cout << fixed << setprecision(10) << rec(9, 0) << endl;
}
