#include <bits/stdc++.h>   using namespace std;   const int mod = 1000000007;   const vector<int> mods = {998244353, 1000000007, 1000000009};   const long long inf = 3e18;   const double pi = acos(-1.0);   const double eps = 0.0000001;   mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());   template <class... K>   using umap = unordered_map<K...>;   template <class... K>   using uset = unordered_set<K...>;   double dp[200];   long long lad[200];   int main() {     cin.sync_with_stdio(0);     cin.tie(0);     cout.precision(13);     fill(&dp[0], &dp[0] + sizeof(dp) / sizeof(dp[0]), 0);     for (long long i = (0); i < (10); ++i)       for (long long j = (0); j < (10); ++j) {         long long fw = i & 1;         long long up;         cin >> up;         if (!up) continue;         long long node = 10 * (9 - i) + (fw ? j : 9 - j);         long long nxfw = (i + up) & 1;         long long nx = 10 * (9 - i + up) + (nxfw ? j : 9 - j);         lad[node] = nx;       }     dp[99] = 0.0;     for (long long i = 98; i >= 0; i--) {       double mv = 0;       double ex = 0;       for (long long j = (1); j < (7); ++j) {         double nx = dp[i + j];         if (lad[i + j]) {           nx = min(nx, dp[lad[i + j]]);         }         mv += 1.0 / 6 * nx;         if (i + j > 99) ex++;       }       mv++;       mv /= (1 - ex / 6.0);       dp[i] = mv;     }     cout << dp[0] <<   n ;     return 0;   }   