anchor.diff:  //    B -> 'b', 0.4
   //    B -> 'b', 0.4
   
  -    let check str res = 
  -        let toCheck = recognize str crl srl erl nonterminals S
  +    let printMatrix (matrix: double [,]) strLen searchLen =
  +        let rowLength = matrix.GetLength(0)
  +        let colLength = matrix.GetLength(1)
  +
  +        for i in [0..rowLength-1] do
  +            for j in [0..colLength-1] do
  +                if i <= strLen && j <= strLen && j > i && j-i <= searchLen then
  +                    printf "%.8f  " matrix.[i, j]
  +                else
  +                    assert (matrix.[i, j] = 0.)
  +                    printf "----------  "
  +            printfn ""
  +        printfn ""
  +
  +    let isAnswerValid (matrix: double [,]) strLen searchLen = 
  +        let rowLength = matrix.GetLength(0)
  +        let colLength = matrix.GetLength(1)
  +        if rowLength <> colLength || rowLength <> strLen + 1 then
  +            false
  +        else
  +            let notRealCell (i, j) =
  +                    i > strLen 
  +                    || j > strLen 
  +                    || j <= i 
  +                    || j-i > searchLen 
  +
  +            [1..rowLength-1]
  +            |> List.map (fun i -> [1..colLength-1] |> List.map (fun j -> (i,j))) 
  +            |> List.concat
  +            |> List.filter notRealCell
  +            |> List.forall (fun (i, j) -> matrix.[i,j] = 0.)
  +
  +    let check str searchLen = 
  +        let toCheck = recognize str crl srl erl nonterminals S searchLen
  +        assert (isAnswerValid toCheck (String.length str) searchLen)
  +        printMatrix toCheck (String.length str) searchLen 
   //        printfn "%.10f" toCheck |> ignore
  -        assert (abs(res - toCheck) < 1e-14) 
  -      
  -
  -    check "abb"     0.032        |> ignore    
  -    check "aaabbcc" 0.0000524288 |> ignore
  -
  -
  -//    System.Console.ReadLine() |> ignore
  +//        assert (abs(res - toCheck) < 1e-14) 
  +
  +//    check "abb"     0.032        2 |> ignore    
  +//    check "aaabbcc" 0.0000524288 3 |> ignore
  +
  +    check "abb"     2 |> ignore    
  +    check "abb"     3 |> ignore    
  +    check "aaabbcc" 3 |> ignore
  +
  +
  +    System.Console.ReadLine() |> ignore
       0
positive.code:             let d2 = (mid1, m1, mid2, m2)
              let  e = (l1, mid1, mid2, m2)
  
              completeT c |> ignore
              completeP d1 b1 c |> ignore
              completeT d1 |> ignore
  
              if mid2 <= stringSize then
                  completeP d2 c b2 |> ignore
                  completeT d2 |> ignore
                  completeP e b1 d2 |> ignore
                  completeP e d1 b2 |> ignore
                  completeT e  |> ignore
  
      compute 0 (roundedSize + 1) |> ignore
      (tMatrix.Item S).[0, stringSize]
  
  
  [<EntryPoint>]
  
negative.code:                                     
      let completeP where from1 from2 = 
          let completeOnePair (nt1, nt2) =
                  addToP (nt1, nt2) (subMatrixMult tMatrix.[nt1] tMatrix.[nt2] from1 from2) where
          pMatrix |> Map.iter (fun nts _ -> completeOnePair nts)
  
      
      let rec compute l m =
  