#include <bits/stdc++.h>
using namespace std;
long long int board[11][11];
double dp[11][11];
vector<pair<long long int, long long int> > func(long long int l,
                                                 long long int r) {
  vector<pair<long long int, long long int> > v;
  if (l % 2 == 1) {
    long long int x = 6;
    bool left = true;
    while (x--) {
      if (left) {
        if (r == 1) {
          left = false;
          l--;
        } else {
          r--;
        }
        v.push_back(make_pair(l, r));
      } else {
        r++;
        v.push_back(make_pair(l, r));
      }
    }
  } else {
    long long int x = 6;
    bool right = true;
    while (x--) {
      if (right) {
        if (r == 10) {
          right = false;
          ;
          l--;
        } else {
          r++;
        }
        v.push_back(make_pair(l, r));
      } else {
        r--;
        v.push_back(make_pair(l, r));
      }
    }
  }
  return v;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  for (long long int i = 1; i <= 10; i++) {
    for (long long int j = 1; j <= 10; j++) {
      cin >> board[i][j];
    }
  }
  for (long long int i = 2; i <= 6; i++) {
    double x = i;
    double p = (7.0 - x) / 6.0;
    dp[1][i] += 1.0;
    for (long long int j = i - 1; j >= 1; j--) {
      dp[1][i] += (dp[1][j]) / 6.0;
    }
    dp[1][i] = dp[1][i] / (1.0 - p);
  }
  for (long long int i = 1; i <= 10; i++) {
    if (i % 2 == 1) {
      for (long long int j = 1; j <= 10; j++) {
        if (i == 1 && j <= 6) {
          continue;
        }
        vector<pair<long long int, long long int> > v = func(i, j);
        for (long long int k = 0; k < v.size(); k++) {
          dp[i][j] +=
              (1.0 / 6.0) * (min(dp[v[k].first][v[k].second],
                                 dp[v[k].first - board[v[k].first][v[k].second]]
                                   [v[k].second]));
        }
        dp[i][j] += 1.0;
      }
    } else {
      for (long long int j = 10; j >= 1; j--) {
        vector<pair<long long int, long long int> > v = func(i, j);
        for (long long int k = 0; k < v.size(); k++) {
          dp[i][j] +=
              (1.0 / 6.0) * (min(dp[v[k].first][v[k].second],
                                 dp[v[k].first - board[v[k].first][v[k].second]]
                                   [v[k].second]));
        }
        dp[i][j] += 1.0;
      }
    }
  }
  cout << setprecision(12) << dp[10][1];
}
