#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int arr[100];
  for (int i = 0; i < 10; i++) {
    if (i % 2 == 0) {
      for (int c = 0; c < 10; c++) {
        int curr;
        cin >> curr;
        if (curr != 0) {
          if (curr % 2) {
            arr[i * 10 + c] = (i - curr) * 10 + 9 - c;
          } else {
            arr[i * 10 + c] = (i - curr) * 10 + c;
          }
        } else {
          arr[i * 10 + c] = i * 10 + c;
        }
      }
    } else {
      for (int c = 9; c >= 0; c--) {
        int curr;
        cin >> curr;
        if (curr != 0) {
          if (curr % 2) {
            arr[i * 10 + c] = (i - curr) * 10 + 9 - c;
          } else {
            arr[i * 10 + c] = (i - curr) * 10 + c;
          }
        } else {
          arr[i * 10 + c] = i * 10 + c;
        }
      }
    }
  }
  double exp[100];
  exp[0] = 0;
  for (int i = 1; i < 6; i++) {
    exp[i] = 6;
  }
  for (int i = 6; i < 100; i++) {
    double ex = 1;
    for (int a = 1; a <= 6; a++) {
      ex += min(exp[arr[i - a]], exp[i - a]) / 6;
    }
    exp[i] = ex;
  }
  cout << fixed << setprecision(10) << exp[99] << "\n";
}
