#include <bits/stdc++.h>
using namespace std;
mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());
long long inf = 1e18, MOD = 1e9 + 7;
void solve() {
  vector<pair<int, int>> order;
  vector<int> in(100);
  int val = 1, row = 10;
  for (int col = 1; row >= 1; col += val) {
    order.push_back(make_pair(row, col));
    if (row & 1 ^ 1 && col == 10) {
      col++;
      val = -1;
      row--;
    } else if (row & 1 && col == 1) {
      val = 1;
      col--;
      row--;
    }
  }
  map<pair<int, int>, int> pos;
  for (int i = 0; i < 100; i++) pos[order[i]] = i;
  for (int i = 10; i >= 1; i--) {
    for (int j = 1; j <= 10; j++) {
      cin >> in[pos[make_pair(i, j)]];
    }
  }
  vector<long double> dp(100, 0.0);
  dp[0] = 0, dp[1] = 6, dp[2] = 6, dp[3] = 6, dp[4] = 6, dp[5] = 6, dp[6] = 6;
  for (int i = 6; i < 100; i++) {
    dp[i] = 6.0;
    for (int j = 1; j <= 6; j++) {
      pair<int, int> pa = order[i - j];
      pa.first += in[i - j];
      dp[i] += min(dp[i - j], dp[pos[pa]]);
    }
    dp[i] = dp[i] / 6.0;
  }
  cout << fixed << setprecision(12) << dp[99] << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int ti = 1;
  for (int i = 1; i <= ti; i++) {
    solve();
  }
  return 0;
}
